Review main Merged

91259[BUGFIX] Streamline ESC handling in <dialog>

Benjamin Franzke CR +2 V +2 Normal +61 −85 updated 01/30/26, 14:50

Commit message

* With #107443 the iframe keydown handler in modals
   was replaced by native `<dialog>` cancel handling
   which caused ESC to no longer work when pressed in
   an iframe inside the TYPO3 modal.
   The previous iframe event handler is now restored in
   a robust way:

   * It is only allowed to close the modal that opened it
     (not any modal), without reintroducing implicit
     `parent.top.TYPO3…` constructs which were used previously to
     operate both in frame and non-frame contexts.

   * It respects event default prevention and `<input type="search">`
     behavior out of the box. Also previous workarounds have been
     removed from install tool modals.

 * Ensure that the combobox as introduced in #106637
   can be cleared via ESC in modals, but once cleared,
   a consecutive ESC keydown event will not prevent the
   native dialog cancel event (and as such close the modal).

 * The global and implicit `<input type="search">` ESC-key
   interceptor (`@typo3/backend/key-bindings.js`) has been removed.
   It is unneeded for `<dialog>` (#107443) combined with
   `<input type="search">` elements, as the browser native `<dialog>`
   cancel handling will not be triggered if the ESC keypress cleared
   a search field.

   Behavior for nested iframes (where this interceptor was actually
   missing) is now explicitly implemented in `@typo3/backend/modal.js`,
   since we're better of with explicit event handling in the
   modal iframe element, now that this is actually only needed for
   iframes in modals.

 * Respect resilient modal mode when hideCloseButton is activated and
   prevent ESC from closing a dialog. Otherwise google chrome
   would allow to close a persistent modal (like login refresh) by
   pressing ESC multiple times, see:
   https://issues.chromium.org/issues/351867704

Review

  • Code review CR +2 Done
    • Benjamin Franzke +2
    • Garvin Hicking +1
    • Andreas Kienast +1
  • Verified V +2 Done
    • Benjamin Franzke +2
    • Garvin Hicking +1
    • Andreas Kienast +1
    • core-ci +1 CI

Issues 3

Files 12

Review log 2639

Show 814 earlier messages
  1. Benjamin Franzke uploaded patch set 1 10/26/25, 20:33

  2. core-ci voted on patch set 1 V +1 10/26/25, 20:40 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/87603

  3. Benjamin Franzke uploaded patch set 2 V +1 10/26/25, 20:54

  4. core-ci voted on patch set 2 V +1 10/26/25, 21:01 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/87604

  5. Benjamin Franzke uploaded patch set 3 V +1 10/26/25, 21:38

  6. core-ci voted on patch set 3 V +1 10/26/25, 21:45 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/87605

  7. Benjamin Franzke uploaded patch set 4 V +1 10/26/25, 22:20

  8. core-ci voted on patch set 4 V -1 10/26/25, 22:27 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/87606

  9. Benjamin Franzke uploaded patch set 5 V -1 10/27/25, 05:39

  10. core-ci voted on patch set 5 V +1 10/27/25, 05:46 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/87618

  11. Benjamin Franzke uploaded patch set 6 V +1 10/27/25, 06:02

  12. core-ci voted on patch set 6 V +1 10/27/25, 06:09 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/87620

  13. Michael Telgkamp commented on patch set 6 V -1 10/27/25, 10:10

    For iframe variant of the problem `ESC` works now, for the filter button, the `ESC` button still does not work for me.
  14. Benjamin Franzke commented on patch set 6 CR -1 10/27/25, 10:13

    Reply

    ack, confirmed, bootstrap dropdown intercepts Escape, so that dialog's cancel event is not fired. 😞 Will try to look into it.
  1. Benjamin Franzke uploaded patch set 7 CR -1 V +1 10/27/25, 11:52

  2. Benjamin Franzke commented on patch set 7 10/27/25, 11:52

    Reply

    Done, we can detect what happens, because bootstrap at least allows the keyboard event to bubble, when no action (dropdown close) was performed. Solved for dropdown buttons in regular modals (global search) and iframe modals (link wizard/element browser). Thanks for reporting!
  3. core-ci voted on patch set 7 V +1 10/27/25, 12:01 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/87642

  4. Benjamin Franzke uploaded patch set 8 V +1 10/28/25, 12:13

  5. Benjamin Franzke updated the commit message in patch set 9 10/28/25, 12:17

  6. core-ci voted on patch set 8 V +1 10/28/25, 12:25 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/87817

  7. core-ci voted on patch set 9 V +1 10/28/25, 12:26 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/87818

  8. Andreas Kienast uploaded patch set 10 V +1 11/20/25, 05:11

  9. Andreas Kienast voted on patch set 10 CR +1 V +1 11/20/25, 05:16

  10. core-ci voted on patch set 10 V +1 11/20/25, 05:18 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/90228

  11. Michael Telgkamp commented on patch set 10 V -1 11/20/25, 08:09

    With this version I cannot close the "New file" dialog in the "Filelist" module when anything inside the iframe is selected. The dialog does the shake move, but stays open. Is that intended? I would expect the dialog to be closed when pressing ESC.
  12. Garvin Hicking uploaded patch set 11 CR +1 V +1 01/25/26, 00:19

    address merge conflict
  13. Garvin Hicking commented on patch set 11 V +1 01/25/26, 00:20

    Reply

    I can't reproduce this in chromium or FF on macos - I can close that dialog just fine, no matter what I select. Can you show a screenshot or so?
  14. core-ci voted on patch set 11 V +1 01/25/26, 00:26 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/94275

  15. Benjamin Franzke commented on patch set 11 01/28/26, 17:00

    Reply Unresolved

    Hey Michael, I remember we had an issue that bootstrap-dropdown intercepted the Escape keypress, which was fixed in 6..7 – as I can't reproduce it either, my guess is that your checkout still used a cached `modal.js`. I think we should try to merge and can fix afterwards..

    modal.ts:133

    Can probably be removed again, since we replaced bootstrap dropdown in: > 92434: [TASK] Replace Bootstrap dropdown with Popover API | https://review.typo3.org/c/Packages/TYPO3.CMS/+/92434
  16. Benjamin Franzke uploaded patch set 12 V +1 01/28/26, 17:05

  17. Benjamin Franzke commented on patch set 12 01/28/26, 17:05

    modal.ts:133 Reply

    Done
  18. core-ci voted on patch set 12 V +1 01/28/26, 17:14 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/94520

  19. Garvin Hicking commented on patch set 12 CR +1 V +1 01/30/26, 08:11

    (Core-review is a bit of 'wishful-thinking' but I'm feeling lucky)
  20. Benjamin Franzke uploaded patch set 13 CR +1 V +1 01/30/26, 09:54

  21. core-ci voted on patch set 13 V +1 01/30/26, 10:02 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/94633

  22. Garvin Hicking voted on patch set 13 CR +1 V +1 01/30/26, 14:35

  23. Andreas Kienast voted on patch set 13 CR +1 V +1 01/30/26, 14:48

  24. Benjamin Franzke voted on patch set 13 CR +2 V +2 01/30/26, 14:49

  25. Benjamin Franzke merged patch set 14 01/30/26, 14:50