85475[BUGFIX] Improve accessibility of module-menu
Commit message
Review
-
Code review CR +2 Done
- Benjamin Kott +2
- Andreas Kienast +1
-
Verified V +2 Done
- Benjamin Kott +2
- Andreas Kienast +1
- core-ci +1 CI
Issues 1
Files 3
Review log 5263
Show 3338 earlier messages
-
Ayke Halder uploaded patch set 1 08/01/24, 21:20
-
core-ci voted on patch set 1 V +1 08/01/24, 21:44 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/62667
-
Benni Mack updated the commit message in patch set 2
V +110/18/24, 13:40 -
Benni Mack rebased onto patch set 3 12/11/24, 11:38
-
core-ci voted on patch set 3 V +1 12/11/24, 11:45 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/70923
-
Michael Telgkamp commented on patch set 3 CR +1 01/14/25, 11:16
Thank you for the patch, it looks fine for meModuleMenu.html:80I would suggest changing the `aria-haspopup` value to `menu` to be more explicit. For other types of popup (like tree, grid, dialog) it is required to use other values. In this occurrence it is fine to leave it as it is as the value `true` defaults to `menu`. -
Michael Telgkamp voted on patch set 3 V +1 01/14/25, 11:16
-
Benjamin Kott commented on patch set 3 01/14/25, 14:16
ModuleMenu.html:23See comment below, i am also not having access to this information.ModuleMenu.html:48We are adding labels here, but i am unable to test this. could you please help me. The menu is not focusable itself, so the Screenreader NVDA / Narrator are not accessing the information. -
Benjamin Kott commented on patch set 3 01/14/25, 14:20
this tree/menu behaves differently than using the pagetree. while i am able to navigate to the first child when pressing "->" the node does not collapse then pressing "<-" check against pagetree. The tree implementation also always moves to the next visible not not caring about tree structure - while this implementation steps through the groups. I am unable to see what is the correct imlementation, the tree feels better to be honest, the module menu navigation feels sluggy with a lot of shifts. -
Ayke Halder commented on patch set 3 01/14/25, 15:19
ModuleMenu.html:48ReplyIn general use Firefox's DevTools A11y-tool (`Shift` + `F12`): Select the `nav` element and have a detailed look at all the text-nodes and structure from an a11y viewpoint. See https://forge.typo3.org/attachments/39293 ---- These ARIA-labels a readout by screenreader (SR): * "Navigation 'Module Menu'" * "'Module menu' menu-bar." * "'Web' menu. Opens menu." To reproduce: 1. Switch SR to "browse mode" ("Stöbernmodus") instead of "focus mode". 2. Navigate from TYPO3 top-bar to main-menu using `Down`/`Up` arrow keys - that is the way the navigation is handled by SR in browse-mode. (Do not use the `Tab`-key !) SR "Orca" readout: "Navigation 'Module Menu'. 'Module menu' menu-bar. 'Dashboard' selected." 3. Switch to "focus mode". 4. Navigate from 'Dashboard' to next entry 'Web' using `Down` arrow key - navigation should be handled by TYPO3's JS-menu-implementation now. SR "Orca" readout: "'Web' menu. Opens menu." 5. Press `Enter` or `Right` arrow key. SR "Orca" readout: "'Web' menu. 'Page'" About "browse mode": https://www.accessibility-developer-guide.com/knowledge/screen-readers/desktop/browse-focus-modes/#browse-mode About NVDA switching browse/focus mode: keys `Insert` + `Space` https://www.browserstack.com/docs/live/references/accessibility-shortcuts-win#browse-mode -
Ayke Halder commented on patch set 3 01/14/25, 15:34
Reply
The navigation concept implemented here tries to replicate a standard application-menu with dropdowns for the second level. So now it should be possible to navigate the TYPO3 module-menu like you would (blind-folded) navigate a 2-level standard-menu. This is actually an adapted approach of the example code from here: https://www.w3.org/WAI/ARIA/apg/patterns/menubar/examples/menubar-navigation/#sc_label ---- Tree implementation is for tree - it has `level`-information for the screenreader. -
Ayke Halder commented on patch set 3 01/14/25, 15:48
ModuleMenu.html:80ReplyOkay, let's go for `aria-haspopup="menu"`. https://a11ysupport.io/tests/tech__aria__aria-haspopup-attribute#assertion-aria-aria-haspopup_attribute-convey_value_menu-html-button_element ---- The code implemented here is actually an adapted approach of this example code: https://www.w3.org/WAI/ARIA/apg/patterns/menubar/examples/menubar-navigation/#sc_label -
Ayke Halder uploaded patch set 4
CR +1V +101/14/25, 16:08 -
Ayke Halder commented on patch set 4 01/14/25, 16:12
ModuleMenu.html:80ReplyChanged to `menu`. Also see https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-haspopup#description > Note: Make sure the role of the element that serves as the container for the popup content is a `menu`, `listbox`, `tree`, `grid` or `dialog` and **that the value of `aria-haspopup` matches the role of the popup container**. -
core-ci voted on patch set 4 V +1 01/14/25, 16:15 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/72468
-
Michael Telgkamp commented on patch set 4 CR +1 V +1 01/14/25, 16:37
ModuleMenu.html:23ReplySimilar to the other aria-label in Spec and also MDN it says > If a menubar has a visible label, include aria-labelledby set to a value that refers to the labelling element. Otherwise, provide the menubar with an accessible name by including a descriptive aria-label.ModuleMenu.html:48ReplyIn https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/menu_role#associated_wai-aria_roles_states_and_properties (and in the ARIA Spec) it says > The menu is required to have an accessible name. Use aria-labelledby if a visible label is present, otherwise use aria-label. Either include the aria-labelledby set to a the id to the menuitem or button that controls its display or use aria-label to define the label. -
Benjamin Kott commented on patch set 4 01/15/25, 08:03
ModuleMenu.html:23Replysee belowModuleMenu.html:48ReplyThis seems to be incomplete, while with NVDA enabled i can see that firefox enables the landmark and also makes it focusable - but this is only true for firefox and excludes chromium-based browsers (i do not have a setup for safari). Anyways, even firefox notes that clickable elements need to be interactive, this is missing for the navigation elements, as soon as these are made interactive also chrome is able to access the landmarks. See https://developer.mozilla.org/en-US/docs/Web/Accessibility/Understanding_WCAG/Keyboard -
Benjamin Kott commented on patch set 4 01/15/25, 08:06
Reply
in the example the dropdown is closed as soon as you leave the submenu this would match the tree behaviour and collapsing of the node. -
Ayke Halder commented on patch set 4 01/15/25, 14:28
Reply
I decided against auto-closing all sub-nodes. If a user uses assistive technology like screenreader + screen magnifier it's better to still keep a sub-menu open and the sub-menu entries visible - as long as the user does not closes the sub-menu by intention e.g. press `Escape`.ModuleMenu.html:48ReplyIn general for assistive technology it's always necessary to test the setup. I would categorize the following example which includes `aria-label` as "tested". https://www.w3.org/WAI/ARIA/apg/patterns/menubar/examples/menubar-navigation/#sc_label Also the `aria-label` is announced by SR with Firefox in use. So I'd like to keep the `aria-label`. As alternative we might go for using `aria-labelledby` pointing to the button-label that activates the menu. (But actually I like how `aria-label` opens the option to name the menu and the button differently. And `aria-label` also saves us from adding an `id`-attribute to the button/label.) ---- About the new point: > clickable elements need to be interactive, this is missing for the `<nav>`-element Here I'd like to get help to find a working (*read:* Firefox annotation is gone.) solution. This solution might also solve the somehow cumbersome necessity to switch from "browse mode" to "focus mode" - see mentioned step 3 above: > 3. Switch to "focus mode". My guess: It's all about these unecessary and wrongly used `tabindex="-1"` for the menu entries. **Important note:** screenreader users do not depend on navigating by `Tab` key only! That's why we do not need to implement a kind of smooth handling of the backend by using `Tab` key. only E.g. a user of assistive technology might use "landmark navigation" https://emmabuntus.org/first-steps-with-the-orca-screen-reader/#Moving_by_landmarks So there is absolutely no necessity to hide all the menu links via `tabindex="-1"`, as a SR user just jumps over the whole nav-menu and goes straigt to the content area. For the not so tech-savvy SR user we might add SR-only-visible **skip-link** in front of the nav-menu which targets an extra element directly after the nav-menu. ```html <a href="#modulemenuend" class="sr-only-but-visible-on-keyboard-focus"> Skip module menu navigation </a> <nav> … </nav> <main id="modulemenuend"> ``` About skip-link: https://webaim.org/techniques/skipnav/ -
Ayke Halder uploaded patch set 5
CR +1V +101/15/25, 14:57 -
core-ci voted on patch set 5 V +1 01/15/25, 15:05 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/72531
-
Benjamin Kott commented on patch set 5 01/16/25, 08:42
ModuleMenu.html:6nav element is identified in firefox as an interactive element and it tabbable by default. chromium based browsers handle this different. a tabindex="0" is required here to have firefox and chrome behaving the same on tabbing - as mentioned before.Main.html:33I don't think that we need a tabindex here. -
Ayke Halder commented on patch set 5 01/16/25, 10:06
ModuleMenu.html:6ReplyUsing SR and Firefox the `<nav>`-element is not focused. Focus goes to the first `menuitem` of the first `menu`/`menubar` inside `<nav>`.ModuleMenu.html:48ReplyIssue with the additionaly necessary "step 3" to "switch focus mode" is solved now.Main.html:33ReplyThis is an improvement for users navigating by `Tab`-key. The module-menu might get scrollbars: ```css .scaffold-modulemenu { position: sticky; […] height: calc(100vh - var(--scaffold-header-height)); max-width: 100%; overflow-x: hidden; overflow-y: auto; […] } ``` * If all the menu items **fit** into the box, there are no scrollbars and there **is no** `Tab`-stop. * If all the menu items **do not fit** into the box (e.g. most sub-menus are opened), there are scrollbars and there **is a** `Tab`-stop. Adding `tabindex="-1"` here disables the `Tab`-stop in case of overflowing menu items. Thereby the `Tab`-stops behave **consistent** which is very important for the SR user. Also there was neither a SR announcement nor a visual feedback to the user about the focused `div.scaffold-modulemenu`-element in case of a `Tab`-stop. So I would like to keep this added `tabindex="-1"` here. ---- In general this `Tab`-stop might be usable for users to scroll up and down the menu box using `Up`/`Down` arrow-keys. In case of SR users: * SR in browse-mode: `Up`/`Down` arrow-keys are in use by SR to switch to the next element - no scrolling available here. * Manually scrolling the menu box is not necessary: on focusing a menu item, the box auto-scrolls the focuseed menu item into the view. -
Ayke Halder commented on patch set 5 01/16/25, 10:10
Main.html:33ReplyFor debugging: Use `document.activeElement` in Dev-Tools JS-console to check which element has the current focus. Also see: https://developer.mozilla.org/en-US/docs/Web/API/Document/activeElement -
Benjamin Kott commented on patch set 5 01/16/25, 11:59
Main.html:33ReplyRegarding the tabindex -1 Ack, this explains the different behavior of Firefox and chromium-based browsers here, as they do not target scrollable containers by default. See: https://bugzilla.mozilla.org/show_bug.cgi?id=1069739#c23 See: https://issues.chromium.org/issues/40603323 If the tab index of the scroller is >= 0, then focus on scroller. If the tab index of the scroller is < 0, then do not focus on scroller. If the tab index of the scroller is undefined, then keyboard-focus the scroller only if it does not contain any keyboard focusable children. See: https://chromium.googlesource.com/chromium/src/+/8a837983aa1aca7e72b1579e01ea585f8ee3b648 My conclusion here is the following: - Firefox has a flawed implementation as it makes the container focusable even when focusable children exist. - Adding tabindex-1 improves the keyboard navigation, but also makes the container focusable in general, and we would need to add JavaScript to avoid this to prevent the focus. - Users know their browsers and their quirks. means that this is will not be an unknown behavior for Firefox users - and only confuse people that are not using it regular and are used to a different behavior. - It´s a Firefox problem, Firefox need to fix this. -
Benjamin Kott commented on patch set 5 01/16/25, 12:09
ModuleMenu.html:6ReplyIt´s correct that the nav element is not focused. But Firefox is asking to make this focusable. (Send DM for clarification) -
Benjamin Kott commented on patch set 5 01/16/25, 12:17
ModuleMenu.html:23ReplyDone -
Benjamin Kott commented on patch set 5 01/16/25, 12:30
Reply
Ack, i still also want to close the menu by pressing <- on the "category" item first level -
Benjamin Kott commented on patch set 5 01/16/25, 12:32
ModuleMenu.html:48ReplyClosing this note down, as it´s usage has been clarified. -
Ayke Halder commented on patch set 5 01/16/25, 15:34
Reply
Actually until now this change here did not touch how the arrow-keys worked. If we change how the arrow keys work, I suggest to really stick with one of the maybe "user-known" default behaviours for arrow-key navigation. **Option A:** https://www.w3.org/WAI/ARIA/apg/patterns/menubar/examples/menubar-navigation/#kbd_label As we have a vertical menu here the usage of "right/left moves to next/previous category-item" and "down/up both opens the sub-menu" might be slightly counter-intuitive at first. But this is the only working solution in combination with "while inside submenu a right-arrow keypress" will directly switch to the next "category-submenu" and focuses its first entry. **Option B:** https://www.w3.org/WAI/ARIA/apg/patterns/disclosure/examples/disclosure-navigation/#kbd_label Here `Down`/`Right` arrow-keys have completely identical behaviour: select next item And also `Up`/`Left` have completely identical behaviour: select previous item.ModuleMenu.html:6ReplySo what are we going to do here? * Option A: Make the `<nav>` focusable (e.g. add `tabindex="0"`) and make it also interactive (e.g. implement JS `click`- and `keydown`-handler which just focuses the first `menuitem`). Plus additionally every focusable element must also have proper focus-indication, so add some CSS for `nav:focus-visible`. * Option B: Just ignore what Firefox is asking for. Because on focusing⁺ the `<nav>`-element, actually the first `menuitem` is already focused in Firefox - so everything is already working as intended. ⁺ Focusing the `<nav>`-element can be done via `Tab`-key-navigation or in SR browse-mode using `Up`/`Down` arrow-keys or SR landmark navigation.Main.html:33ReplyThanks for pointing to these bug reports! I just read across the Chromium and Firefox bug comments. So just let Firefox handle it its own way. The argument why this will not change in Firefox is here: https://bugzilla.mozilla.org/show_bug.cgi?id=1069739#c36 > I want to stress that this is a feature of Firefox, not a bug. > … > If you create a scrolling area that cannot be scrolled by keyboard alone, then you will have made a WCAG 2.1 SC 2.1.1 Keyboard (A) failure. > … > References: > * WCAG 2.1 SC 2.1.1 Keyboard (Level A): https://www.w3.org/WAI/WCAG21/quickref/#keyboard > … -
Ayke Halder commented on patch set 5 01/16/25, 15:47
ModuleMenu.html:6Reply⁺ In SR browse-mode using `Up`/`Down` arrow-keys or using SR landmark navigation moves only the "screen-reader focus", but does not move the real browser focus. https://tink.uk/the-difference-between-keyboard-and-screen-reader-navigation/ Be aware of overssimplification in this article: > Screen reader users: people who don't use a mouse and can't see the content. Usually specially abled people are using a combination of screen-magnification plus screen-reader and therby actually seeing the content plus having voice-over. -
Ayke Halder uploaded patch set 6
V +101/17/25, 08:51 -
core-ci voted on patch set 6 V +1 01/17/25, 08:57 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/72604
-
Benjamin Kott commented on patch set 6 01/17/25, 09:53
ModuleMenu.html:6ReplyI am not sure about this, as i have really no clue why it should be focusable. I am missing the knowledge here and i cannot find anything that helps me really understand the remark of Firefox. That means, i am unable to dismiss the note here and can just mention it. We need to take an informed decision here, and i can also be - we ignore the annotation of Firefox, because we know better. If you think, we can safely ignore the annotation. I am fine and you can resolve this part of the conversation. -
Ayke Halder commented on patch set 6 01/17/25, 10:23
ModuleMenu.html:6ReplyConclusion: we can just ignore this warning here. There are two `click`-events and one `keydown`-event bound to the `<nav>`-element. Firefox concludes: If any `click`/`keydown`-event is bound to an element, the element is interactive and therefore must also become focusable (e.g. `tabindex="0"`). But here the `<nav>` element actually is not interactive, as all the bound events are only events for delegation. Actually the sibling-elements are interactive and trigger these events. https://github.com/TYPO3/typo3/blob/052b80b2d0b49bb6c3078e943b4a2ba1babd512b/Build/Sources/TypeScript/backend/module-menu.ts#L390-L406 ```js new RegularEvent('keydown', …).delegateTo(moduleMenu, ModuleMenuSelector.item); new RegularEvent('click', …).delegateTo(moduleMenu, ModuleSelector.link); new RegularEvent('click', …).delegateTo(moduleMenu, ModuleMenuSelector.collapsible); . ``` -
Ayke Halder commented on patch set 6 01/17/25, 10:32
ModuleMenu.html:6Reply*Correction:* Actually the **child/descendant**-elements are interactive and trigger these events. -
Ayke Halder commented on patch set 6 01/17/25, 17:05
Reply
Please try these different implementations: Check out how using the `Left`/`Right` arrow-keys feels, especially while focusing a menuitem inside a sub-menu. Always wait for the opening/closing-animation to completely finish before pressing another button. * (A) Reference implementation of an absolute standard horizontal menubar + vertical submenu: See https://www.w3.org/WAI/ARIA/apg/patterns/menubar/examples/menubar-navigation/#kbd_label 87793: [BUGFIX] Improve accessibility of module-menu - menu-test horizontal+vertical https://review.typo3.org/c/Packages/TYPO3.CMS/+/87793 * (B) Vertical menubar + vertical submenu (switched arrow-key actions on menubar) 87794: [BUGFIX] Improve accessibility of module-menu - menu-test vertical+vertical https://review.typo3.org/c/Packages/TYPO3.CMS/+/87794 * (C) Horizontal + vertical - tweaked auto-opening/closing of sub-menus 87795: [BUGFIX] Improve accessibility of module-menu - menu-test horizontal+vertical with full auto-closing and auto-opening of sub-menus https://review.typo3.org/c/Packages/TYPO3.CMS/+/87795 * (D) Horizontal + vertical - completely disabled auto-opening/closing of sub-menus 87797: [BUGFIX] Improve accessibility of module-menu - menu-test horizontal+vertical without any auto-closing or auto-opening of sub-menus https://review.typo3.org/c/Packages/TYPO3.CMS/+/87797 -
Ayke Halder commented on patch set 6 01/17/25, 18:04
Reply
Vertical + horizontal options: * (A-vertical) Reference implementation of an absolute standard vertical menubar + horizontal submenu 87798: [BUGFIX] Improve accessibility of module-menu - menu-test vertical+horizontal https://review.typo3.org/c/Packages/TYPO3.CMS/+/87798 * (C-vertical) Vertical + horizontal - tweaked auto-opening/closing of sub-menus 87799: [BUGFIX] Improve accessibility of module-menu - menu-test vertical+horizontal with full auto-closing and auto-opening of sub-menus https://review.typo3.org/c/Packages/TYPO3.CMS/+/87799 * (D-vertical) Vertical + horizontal - completely disabled auto-opening/closing of sub-menus 87800: [BUGFIX] Improve accessibility of module-menu - menu-test vertical+horizontal without any auto-closing or auto-opening of sub-menus https://review.typo3.org/c/Packages/TYPO3.CMS/+/87800
-
Benjamin Kott uploaded patch set 7
V +101/22/25, 09:25 -
Benjamin Kott commented on patch set 7 CR +1 V +1 01/22/25, 09:27
Reply
I´ve implemented the desired changes now. Pressing the right arrow key will now close the submenu again when the toggle is focused. In all mapped keyboard events will now prevent the default behavior. This prevents the unnecessary scrolling when using the UP and DOWN keys. -
Benjamin Kott commented on patch set 7 01/22/25, 09:28
Reply
I mean LEFT arrow key. -
Benjamin Kott updated the commit message in patch set 8
CR +1V +101/22/25, 09:28 -
Benjamin Kott voted on patch set 8 CR +1 V +1 01/22/25, 09:28
-
core-ci voted on patch set 7 V +1 01/22/25, 09:33 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/72830
-
core-ci voted on patch set 8 V +1 01/22/25, 09:37 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/72832
-
Benjamin Kott voted on patch set 8 CR -1 01/22/25, 09:52
-
Benjamin Kott uploaded patch set 9
CR -1V +101/22/25, 09:55 -
Benjamin Kott voted on patch set 9 CR +1 V +1 01/22/25, 09:55
-
core-ci voted on patch set 9 V +1 01/22/25, 10:01 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/72833
-
Ayke Halder commented on patch set 9 V -1 01/22/25, 10:54
`event.defaultPrevented` must not be used greedy. Default software shortcuts like `Alt`+`Arrow-left` to navigate back in browser history are not working anymore when the menu is focused. Details on this very same issue: https://review.typo3.org/c/Packages/TYPO3.CMS/+/83566/comments/e8ae11df_8b638593 A general `keyShouldBeHandled` check which takes control-keys into account: https://review.typo3.org/c/Packages/TYPO3.CMS/+/83566/comment/69b7a820_5d5e28df/ -
Benjamin Kott commented on patch set 9 CR 0 V 0 01/22/25, 11:20
Reply
gotcha, good catch. would you like to do the adjustments to make it less greedy? -
Ayke Halder uploaded patch set 10
V +101/22/25, 14:06 -
core-ci voted on patch set 10 V +1 01/22/25, 14:12 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/72859
-
Ayke Halder commented on patch set 10 01/22/25, 14:27
Reply
I reverted the check for 'handledKeys'. This is something I like to re-introduce with another change that really makes this a `role="menubar"` with all its key-controls implemented. Right now there is still a `Ctrl`+`Home` and `Ctrl`+`End` action implemented, which is taken from `role="grid"` and should be removed here. Then a 'handledKeys'-check can be implemented more easily. (Removing these key-controls is a real change which should be implemented as a Task/Feature and should not be backported to v13.4) See https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/grid_role#keyboard_interactions The new `LeftArrow` handling is still in place. Additionally `Enter` and `Space` keypress activates the menuitem now. Before only `Enter` was implemented. See https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/menuitem_role#enter -
Benjamin Kott commented on patch set 10 CR -1 01/22/25, 15:25
Reply
But you now also reverted the scrolling fix, because arrow up and down are now also scrolling scrollable container. I´ve prevented all actions to ensure we have no side-effects. We not at-least need to prevent it on up and down arrow keys when we do not want to implement a control key handling. -
Ayke Halder uploaded patch set 11
CR -1V +101/22/25, 21:40 -
core-ci voted on patch set 11 V +1 01/22/25, 21:46 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/72887
-
Benjamin Kott voted on patch set 11 CR +1 V +1 01/23/25, 06:43
-
Andreas Kienast uploaded patch set 12
CR +1V +101/23/25, 09:50 -
Andreas Kienast voted on patch set 12 CR +1 V +1 01/23/25, 09:50
-
core-ci voted on patch set 12 V +1 01/23/25, 09:58 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/72914
-
Benjamin Kott voted on patch set 12 CR +2 V +2 01/23/25, 12:16
-
Benjamin Kott merged patch set 13 01/23/25, 12:24