Review main Merged

80266[FEATURE] Add hotkey API to TYPO3 backend

Andreas Kienast CR +2 V +2 Hard +400 −20 updated 11/27/23, 09:27

Commit message

TYPO3 provides a new API to let developers easily add keyboard
shortcuts to execute certain actions.

The following shortcuts are already in place:

* Ctrl/Cmd + K: Open LiveSearch
* Ctrl/Cmd + S: Save open FormEngine record

The API allows to register hotkeys in scoped maps, where the scope can
be changed during runtime. However, hotkeys registered in the `all`
scope are always executed, if found, to avoid overriding global
shortcuts.

Review

  • Code review CR +2 Done
    • Andreas Kienast +2
    • Christian Kuhn +1
    • Benni Mack +1
  • Verified V +2 Done
    • Andreas Kienast +2
    • Christian Kuhn +1
    • Benni Mack +1
    • core-ci +1 CI

Issues 1

Files 11

Review log 5477

Show 3652 earlier messages
  1. Andreas Kienast uploaded patch set 1 07/31/23, 09:23

  2. core-ci voted on patch set 1 V +1 07/31/23, 09:30 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/44788

  3. Andreas Kienast uploaded patch set 2 V +1 07/31/23, 10:34

  4. core-ci voted on patch set 2 V +1 07/31/23, 10:43 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/44799

  5. Andreas Kienast uploaded patch set 3 V +1 07/31/23, 11:55

  6. core-ci voted on patch set 3 V +1 07/31/23, 12:02 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/44809

  7. Andreas Kienast uploaded patch set 4 V +1 07/31/23, 12:37

  8. core-ci voted on patch set 4 V +1 07/31/23, 12:53 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/44816

  9. Andreas Kienast uploaded patch set 5 V +1 07/31/23, 13:30

  10. Mathias Brodala commented on patch set 5 CR -1 07/31/23, 13:39

    Feature-101507-HotkeyAPI.rst:24

    This should clarify if hotkeys without modifiers can be registered. Personally I'd not allow this since it would cause unexpected behavior. E.g. closing a sibling tab via "Ctrl+D" could trigger a hotkey for "D" in TYPO3 if it gets focus next. See https://github.com/jitsi/jitsi-meet/pull/13520

    Feature-101507-HotkeyAPI.rst:34

    This should be "allowOnEditables" and "false" by default. We should try to avoid enabling something to disable something like TYPO3 did in its history.
  11. core-ci voted on patch set 5 V +1 07/31/23, 13:40 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/44818

  12. Andreas Kienast commented on patch set 5 07/31/23, 13:53

    Feature-101507-HotkeyAPI.rst:24 Reply

    Ctrl+D won‘t trigger a hotkey that listens to „D“ only, this is caught already. I agree on the documentation part.

    Feature-101507-HotkeyAPI.rst:34 Reply

    Ack
  13. Andreas Kienast uploaded patch set 6 CR -1 V +1 07/31/23, 14:26

  14. Andreas Kienast commented on patch set 6 07/31/23, 14:27

    Feature-101507-HotkeyAPI.rst:24 Reply

    Done
  15. core-ci voted on patch set 6 V +1 07/31/23, 14:33 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/44824

  16. Simon Schaufelberger commented on patch set 6 CR -1 07/31/23, 20:41

    index.d.ts:14

    this is not sorted alphabetically. can this be done?
  17. Simon Schaufelberger commented on patch set 6 08/01/23, 01:36

    I would also add "?" as hot key and show a modal with an overview over all hot keys.
  18. Mathias Brodala commented on patch set 6 08/01/23, 07:15

    Reply

    Sounds like a good idea but should be done separately IMO to keep this one small.
  19. Andreas Kienast commented on patch set 6 08/01/23, 07:30

    index.d.ts:14 Reply

    Of course I can solve this issue.
  20. Andreas Kienast uploaded patch set 7 CR -1 V +1 08/01/23, 07:30

  21. Andreas Kienast commented on patch set 7 08/01/23, 07:31

    Reply

    Since the limitation mentioned in the ReST is currently in place, this cannot be done in a sane way. Will be done at a later point.
  22. core-ci voted on patch set 7 V +1 08/01/23, 07:37 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/44848

  23. Andreas Kienast commented on patch set 7 08/01/23, 07:54

    index.d.ts:14 Reply

    Done
  24. Simon Schaufelberger voted on patch set 7 CR +1 08/01/23, 14:56

  25. Andreas Kienast uploaded patch set 8 CR +1 V +1 08/02/23, 12:57

  26. Andreas Kienast commented on patch set 8 CR -1 08/02/23, 13:01

    Will rework the scoping stuff a bit to allow setting the scope automatically.
  27. core-ci voted on patch set 8 V +1 08/02/23, 13:06 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/44890

  28. Andreas Kienast uploaded patch set 9 CR -1 V +1 08/02/23, 13:50

  29. core-ci voted on patch set 9 V +1 08/02/23, 13:57 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/44893

  30. Andreas Kienast uploaded patch set 10 V +1 08/14/23, 11:22

  31. core-ci voted on patch set 10 V +1 08/14/23, 11:29 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/45479

  32. Stefan Bürk voted on patch set 10 V +1 CR +1 08/15/23, 10:32

  33. Andreas Kienast uploaded patch set 11 CR +1 V +1 08/17/23, 11:36

  34. core-ci voted on patch set 11 V +1 08/17/23, 11:43 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/45577

  35. Andreas Kienast uploaded patch set 12 V +1 09/05/23, 06:04

  36. core-ci voted on patch set 12 V +1 09/05/23, 06:26 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/46209

  37. Garvin Hicking commented on patch set 12 09/05/23, 07:12

    Very minor typo in docblock. Cool stuff! :)

    hotkeys.ts:30

    Typo, should be "switched"?
  38. Andreas Kienast commented on patch set 12 09/05/23, 07:25

    Reply

    Good catch!

    hotkeys.ts:30 Reply

    Ack
  39. Andreas Kienast uploaded patch set 13 V +1 09/05/23, 07:25

  40. core-ci voted on patch set 13 V +1 09/05/23, 07:32 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/46215

  41. Stefan Bürk voted on patch set 13 V +1 CR +1 09/05/23, 09:09

  42. Andreas Kienast uploaded patch set 14 CR +1 V +1 09/07/23, 08:54

  43. core-ci voted on patch set 14 V +1 09/07/23, 09:02 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/46335

  44. Andreas Kienast uploaded patch set 15 V +1 09/07/23, 10:45

  45. core-ci voted on patch set 15 V +1 09/07/23, 10:57 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/46345

  46. Andreas Kienast commented on patch set 15 CR -1 09/12/23, 07:23

    Perhaps we have to take accessibility into account as well (e.g `aria-keyshortcuts`).
  47. Andreas Kienast uploaded patch set 16 CR -1 V +1 09/14/23, 06:14

  48. core-ci voted on patch set 16 V +1 09/14/23, 06:21 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/46559

  49. Guido Schmechel commented on patch set 16 09/15/23, 20:37

    I love this feature already. Tested with Win and Chrome 117. Everything fine. Registering a new key also worked. https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-keyshortcuts aria-keyshortcuts seems to make sense and we should offer it. Do we actually need a kind of StopList for certain keys? "Don't override browser, assistive technology, or operating system shortcuts" In addition, it would also be optimal to see the registered hotkeys + scope somewhere. Maybe something for a follow-up patch and the configuration module.
  50. Andreas Kienast commented on patch set 16 09/16/23, 04:40

    Reply

    Thanks for testing the patch. A „stop list“ sounds nice but is not viable as this depends on the browser and the operating system. Also, TYPO3 uses such keystrokes: * Ctrl/Cmd+K usually focusses the address bar in at least Chrome, but this has a graceful fallback. * Ctrl/Cmd+S‘s behavior is completely useless in the backend, therefore it‘s fine to override it. Having the keystrokes listed somewhere is nice, but at least not in the configuration module as you can register multiple scopes, which is a pure runtime thing. I think, the topbar is *currently* the best location.
  51. Simon Schaufelberger commented on patch set 16 09/17/23, 08:48

    Reply

    @Guido: I already had the idea to add "?" as hot key and show a modal with an overview over all hot keys.
  52. Guido Schmechel commented on patch set 16 09/17/23, 08:58

    Reply

    Yes, I just saw your comment above. A follow-up patch would of course also be OK for me :-) This patch is purely about the API.
  1. Andreas Kienast uploaded patch set 17 V +1 09/19/23, 13:53

  2. Andreas Kienast uploaded patch set 18 09/19/23, 13:58

  3. core-ci voted on patch set 18 V +1 09/19/23, 14:07 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/46791

  4. core-ci voted on patch set 17 V +1 09/19/23, 14:09 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/46788

  5. Andreas Kienast uploaded patch set 19 V +1 09/26/23, 12:37

  6. core-ci voted on patch set 19 V +1 09/26/23, 12:45 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/47185

  7. Stefan Bürk commented on patch set 19 V +1 CR +1 09/26/23, 13:41

    Would suggest to get a vote from some JS pros, for example Benjamin Franzke. For me this looks good codewise. I tested around, seems to work so far. Could not get any error messages in the console or saw anything broken.
  8. Garvin Hicking voted on patch set 19 V +1 CR +1 10/16/23, 06:55

  9. Benni Mack commented on patch set 19 V -1 10/16/23, 06:59

    I told a11y team to give a review (that was 1 month ago). Let's wait until End of october before merging pls - if they don't respond by then, we'll continue.
  10. Andreas Kienast commented on patch set 19 10/31/23, 06:07

    Looks like something changed under the hood. Consecutive Ctrl+S in FormEngine doesn't work anymore after rebase. Investigating...
  11. Andreas Kienast uploaded patch set 20 CR +1 V +1 10/31/23, 06:24

  12. core-ci voted on patch set 20 V +1 10/31/23, 06:31 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/48379

  13. Patrick Schriner commented on patch set 20 11/06/23, 10:57

    Someone mentioned that this could be an accessibility improvement; but two questions remain: if I understand the code correctly, the hotkeys are not really configurable (without heavy javascript). I don't see a possibility to unregister a hotkey either. If the chosen hotkeys interfere with hotkeys used by (common) screen readers, this would probably be worse than before?
  14. Andreas Kienast commented on patch set 20 11/06/23, 11:53

    Reply

    > the hotkeys are not really configurable You mean on a user-basis? That's correct, that's not intended on purpose to have a consistent behavior across several installations. Same goes for de-registration. > If the chosen hotkeys interfere with hotkeys used by (common) screen readers, this would probably be worse than before? I was under the impression that screen readers register shortcuts mutually exclusive, so browser JS cannot intercept the same shortcuts. Also, wouldn't this be an issue with literally any other software / website then as well?
  15. Patrick Schriner commented on patch set 20 11/06/23, 12:25

    Reply

    1) ok - I think having an api for de-registration would be no harm - just a point where someone with a legitimate interest could hook into to prevent conflicts 2) will check on that
  16. Andreas Kienast uploaded patch set 21 V +1 11/07/23, 08:42

  17. core-ci voted on patch set 21 V +1 11/07/23, 08:51 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/48679

  18. Andreas Kienast rebased onto patch set 22 V +1 11/24/23, 09:49

  19. core-ci voted on patch set 22 V +1 11/24/23, 10:20 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/49861

  20. Andreas Kienast uploaded patch set 23 V +1 11/27/23, 08:28

  21. core-ci voted on patch set 23 V +1 11/27/23, 08:34 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/49967

  22. Benni Mack voted on patch set 23 CR +1 V +1 11/27/23, 08:44

  23. Christian Kuhn voted on patch set 23 CR +1 V +1 11/27/23, 08:55

  24. Andreas Kienast voted on patch set 23 CR +2 V +2 11/27/23, 09:27

  25. Andreas Kienast merged patch set 24 11/27/23, 09:27