#109015Missing keyboard focus return after closing modals
Description
In the backend dashboard (top tab bar, e.g. “Add dashboard”, “Configure dashboard”), the keyboard focus is correctly moved into the modal when it opens. After closing the modal (“Cancel”, “Save”, “X” icon or Esc), focus is not returned to the triggering element and may become invisible. Keyboard users lose their point of reference. This affects all modals in the backend. Here is the dashboard mentioned as an example.
Reproduction Steps
- Log into the TYPO3 backend.
- Navigate to the Dashboard.
- Use Tab to focus the “Add dashboard” or “Configure dashboard” button.
- Press Enter to open the modal.
- Close the modal via “Cancel”, “Save”, the “X” icon, or the Esc key.
- Observe that focus is not visible and not on the triggering button.
Impact
- Keyboard users do not know where they are after closing the modal.
- Screen reader users lose context and orientation.
- Violates common accessibility standards (e.g. WCAG focus handling).
- Backend becomes harder to use without a mouse.
Definition of Done
- After closing a dashboard modal, the visible keyboard focus is back on the triggering button.
- Behavior is identical for all close actions (buttons, “X” icon, Esc key).
- Works for all relevant modals in the dashboard tab bar (at least “Add dashboard” and “Configure dashboard”).
- Manually tested using keyboard only (no mouse) in current target browsers: focus is always visible and predictable.
- No regressions for other backend modals.
Acceptance Criteria
- After opening and closing the “Add dashboard” modal, focus returns to the “Add dashboard” button.
- After opening and closing the “Configure dashboard” modal, focus returns to the corresponding button.
- Closing via “Save”, “Cancel”, “X” icon and Esc shows consistent focus restoration behavior.
- No situation where focus “disappears” or is moved to a non-visible element.
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.
Files 2
History 3
-
Benni Mack changed target version <span data-processor="relativetime" data-value="2026-04-21T11:23:50+00:00" > 04/21/26, 11:23 </span>
-
Oliver Bartsch changed Duplicates #108965 <span data-processor="relativetime" data-value="2026-10-21T09:18:50+00:00" > 10/21/26, 09:18 </span>
-
Oliver Bartsch commented and changed status
NewClosed <span data-processor="relativetime" data-value="2026-10-21T09:18:52+00:00" > 10/21/26, 09:18 </span>
Hey,
thanks for the detailed report and the screenshots.
I traced this on main. Modals are created by the Modal API in the top frame, while the dashboard header buttons (“Add dashboard”, “Configure dashboard”, “Delete dashboard”) live inside the module iframe. Since v14 the modal is a native dialog. When it closes, the browser can at best restore focus to the iframe element as a whole, not to the button inside it. On v13 there is no restoration at all. The Modal component itself never remembers or refocuses the trigger. The dashboard does this by hand in exactly one place (the “remove widget” confirmation), which is why the other dashboard modals lose focus.
So this isn’t specific to the dashboard. It’s the general Modal behaviour, and as you wrote, it affects all backend modals. You actually ran into the same problem earlier and reported it as #108965 (“Restore focus to triggering element after closing modal dialogs”, status New). Your dashboard report adds a lot of useful detail there, so I’m closing this one as a duplicate to keep the discussion and the patch in one place. The fix will go into the Modal component: remember the focused element across frames when a modal opens and refocus it when it closes. I’ll include your dashboard acceptance criteria (“Add dashboard”, “Configure dashboard”, all close actions) in the testing for that patch.
Thanks, Oli