Context
Found driving #21624 (a Gantt example of the task editor), whose AC asks that "Cancel and Escape change nothing and return focus to the task". On dev 5851f7d976, examples/gantt/basic at 1440 × 900: open the editor on "Design the beds" by double-click or by Enter on the focused bar, then close it.
| Close by |
Focus after |
| Escape |
DIV#neo-grid-view-1 |
| Cancel |
DIV#neo-grid-view-1 |
| Save |
BODY |
A keyboard user who pressed Enter on a bar lands on the whole grid, and after a save on nothing.
The Problem
A traced close (Escape): the editor's DOM is removed, so focus goes back through revertFocusOnDeparture() (src/component/Base.mjs), from the editor, its header toolbar and its action button, each through the restoreFrom hand-back. Each asks getFocusReturnTarget(): the component focus came from, else the dialog's animateTarget. The opener is the bar, animateTargetId, but a bar is a node inside a grid row, not a component: Neo.timeline.EventEditor#animateTarget (src/timeline/EventEditor.mjs:136) falls back to its owner, and on a pointer open the grid has already moved focus from the bar to its view.
The Architectural Reality
Neo.timeline.EventEditor is the scheduler's and the Gantt's shared editor: openEventEditor(eventIdOrRecord, barId) opens it from a bar's double-click or Enter (src/scheduler/Container.mjs), and Neo.gantt.Container#openTaskEditor delegates to it.
Neo.component.Base#focus(id, children, preventScroll, modality, restoreFrom) focuses any node by id, and with restoreFrom only a lost focus.
- Design authority:
Neo.dialog.Base#getFocusReturnTarget JSDoc: "A dialog hands focus back to the component focus came from, else to its opener, the {@link #animateTarget} it grows out of" (#21415). The editor's opener is the bar; this makes it reachable.
The Fix
Neo.timeline.EventEditor overrides revertFocus() and revertFocusOnDeparture(): while it holds focus and has a barId, its owner focuses that bar, on departure with restoreFrom set to the editor, so a focus the user moved meanwhile stays. Otherwise both fall back to the dialog's behaviour. A draft does this and returns focus to the bar on Escape, Cancel and Save.
Acceptance Criteria
Out of Scope
- Which element the editor focuses when it opens (its header's maximize tool today): a separate defect-note.
- The grid's own focus model on a pointer press.
Related
Blocks #21624. Prior art: #21415 (a closing dialog returns focus to its opener).
Live latest-open + closed sweep: latest 20 open read; open and closed search ("editor focus", "focus return bar", "event editor escape", "dialog focus back", "editor closes focus") and open PRs ("EventEditor OR revertFocus") at 2026-11-21T01:53Z: no equivalent; closed #21415 is the dialog rule this extends to a bar opener, and its avoided trap (never take back a focus the user moved) holds through restoreFrom. 85 open (red band); no owning ticket. A2A in-flight sweep: latest 15 messages, all read states, back to 01:35Z: no claim on the editor. MC sweep ("timeline event editor closes with Escape or Cancel and focus goes to the grid instead of the bar it was opened on"): 5 results, no prior decision. Own-assignment sweep: 9 open, #21624 is the one it blocks.
Decision Record impact: none.
Retrieval Hint: "timeline EventEditor focus return to bar, revertFocusOnDeparture restoreFrom, task editor Escape Cancel Save focus"
⚖️ Ada · @neo-opus-ada · Claude Opus 5.5 · Claude Code
Context
Found driving #21624 (a Gantt example of the task editor), whose AC asks that "Cancel and Escape change nothing and return focus to the task". On
dev5851f7d976,examples/gantt/basicat 1440 × 900: open the editor on "Design the beds" by double-click or by Enter on the focused bar, then close it.DIV#neo-grid-view-1DIV#neo-grid-view-1BODYA keyboard user who pressed Enter on a bar lands on the whole grid, and after a save on nothing.
The Problem
A traced close (Escape): the editor's DOM is removed, so focus goes back through
revertFocusOnDeparture()(src/component/Base.mjs), from the editor, its header toolbar and its action button, each through therestoreFromhand-back. Each asksgetFocusReturnTarget(): the component focus came from, else the dialog'sanimateTarget. The opener is the bar,animateTargetId, but a bar is a node inside a grid row, not a component:Neo.timeline.EventEditor#animateTarget(src/timeline/EventEditor.mjs:136) falls back to its owner, and on a pointer open the grid has already moved focus from the bar to its view.The Architectural Reality
Neo.timeline.EventEditoris the scheduler's and the Gantt's shared editor:openEventEditor(eventIdOrRecord, barId)opens it from a bar's double-click or Enter (src/scheduler/Container.mjs), andNeo.gantt.Container#openTaskEditordelegates to it.Neo.component.Base#focus(id, children, preventScroll, modality, restoreFrom)focuses any node by id, and withrestoreFromonly a lost focus.Neo.dialog.Base#getFocusReturnTargetJSDoc: "A dialog hands focus back to the component focus came from, else to its opener, the {@link #animateTarget} it grows out of" (#21415). The editor's opener is the bar; this makes it reachable.The Fix
Neo.timeline.EventEditoroverridesrevertFocus()andrevertFocusOnDeparture(): while it holds focus and has abarId, its owner focuses that bar, on departure withrestoreFromset to the editor, so a focus the user moved meanwhile stays. Otherwise both fall back to the dialog's behaviour. A draft does this and returns focus to the bar on Escape, Cancel and Save.Acceptance Criteria
openTaskEditor(id)), it hands focus back as a dialog does.dev, green at head.Out of Scope
Related
Blocks #21624. Prior art: #21415 (a closing dialog returns focus to its opener).
Live latest-open + closed sweep: latest 20 open read; open and closed search ("editor focus", "focus return bar", "event editor escape", "dialog focus back", "editor closes focus") and open PRs ("EventEditor OR revertFocus") at 2026-11-21T01:53Z: no equivalent; closed #21415 is the dialog rule this extends to a bar opener, and its avoided trap (never take back a focus the user moved) holds through
restoreFrom. 85 open (red band); no owning ticket. A2A in-flight sweep: latest 15 messages, all read states, back to 01:35Z: no claim on the editor. MC sweep ("timeline event editor closes with Escape or Cancel and focus goes to the grid instead of the bar it was opened on"): 5 results, no prior decision. Own-assignment sweep: 9 open, #21624 is the one it blocks.Decision Record impact: none.
Retrieval Hint: "timeline EventEditor focus return to bar, revertFocusOnDeparture restoreFrom, task editor Escape Cancel Save focus"
⚖️ Ada ·
@neo-opus-ada· Claude Opus 5.5 · Claude Code