Page MenuHomePhabricator

Landmarks in main menu and collapsed TOC are hidden when closed
Closed, DeclinedPublic

Description

Background

Vector checkbox hack implementations use visibility: hidden or display: none to hide the elements when the checkbox is not checked. This removes these elements from the accessibility tree, rendering them inaccessible to screenreader users.

This is problematic for the main menu and collapsed TOC, as the menu trigger is located in a different location in the DOM from the menu content, rendering them inaccessible to screenreader users. This is exacerbated by the fact the landmarks in the main menu and collapsed TOC are in the menu content, and are hidden when the menu is closed (mentioned in T311294). This is particularly an issue for the main menu which is closed by default for anon users, while the TOC is collapsed by default.

A temporary solution could be to make the main menu and collapsed TOC menu contents always available to screenreaders, even when they are closed. This would allow the menu content to at least be discoverable by landmarks.

Developer notes

The simplest solution is to use .ui-helper-hidden-accessibleor equivalent CSS on the main menu and collapsed TOC to visually hide the contents. However this should be a temporary solution, as it would make the TOC and main menu always available to screenreaders even when the menu is closed.

We could also update the HTML/CSS to ensure that the nav element is not hidden when the menu is closed. However, this alone won't help the user experience much because the trigger is not located in the landmark. An ideal solution would ensure the menu trigger is inside the nav landmark, which could be possible for the main menu when we move it to a dropdown menu.

AC

  • Main menu and "Site navigation" landmark is still accessible to screenreaders when the menu is closed
  • TOC and "Contents navigation" landmark is still accessible to screenreaders when the menu is closed

Event Timeline

ovasileva triaged this task as Medium priority.Aug 29 2022, 11:54 AM
ovasileva subscribed.

Moving into planned, pending review from AFB. @bwang - do you think this should potentially be considered a blocker for further deployment? In which case, we can prioritize it sooner.

bwang renamed this task from Avoid using visibility: hidden for main menu and collapsed TOC to Landmarks in main menu and collapsed TOC are hidden when closed.Sep 9 2022, 7:01 PM
bwang updated the task description. (Show Details)

@ovasileva Sorry for the late response! Originally I would have said its not a blocker, but I realized that the main menu is now closed by default for anon users. This would bump up the priority up a bit for me, as it means screenreader users need to know to open the main menu button in order to reach the main menu. The TOC is not collapsed by default so I'm less concerned.

This comment was removed by ovasileva.
ovasileva claimed this task.

Resolved the wrong task by accident, now open again

I just realized that visually hiding the main menu and collapsible TOC will still mean those elements are accessible via tab, which would be very confusing. This task needs some more thought.

I spoke to @Jdrewniak about this task, and it seems there isn't a very good short term solution for improving the accessibility of the main menu and collapsible TOC. The only option we could think of is to visually hide the menu content, and use JS to apply "tabindex" to every tabbable element, which be a pretty hacky solution. This might be something we need to punt to the future for a more involved fix.

For the main menu, we should be able to get a somewhat accessible solution after moving the main menu into a dropdown menu as part of the Article tools work this quarter. However, the main menu will likely still be not accessible when it is "pinned" but that's probably acceptable.
Fixing the collapsed TOC would be more involved and would likely require JS. The existing behavior will probably still need to be maintained for no-js users on smaller viewports, so there will be additional CSS complexity from maintaining two approaches to the collapsed TOC.

@Volker_E @ovasileva My recommendation is to close this task for now, with the understanding that the main menu and collapsed TOC will be inaccessible for the release. The longer term fixes can be included in other tasks.

I spoke to @Jdrewniak about this task, and it seems there isn't a very good short term solution for improving the accessibility of the main menu and collapsible TOC. The only option we could think of is to visually hide the menu content, and use JS to apply "tabindex" to every tabbable element, which be a pretty hacky solution. This might be something we need to punt to the future for a more involved fix.

For the main menu, we should be able to get a somewhat accessible solution after moving the main menu into a dropdown menu as part of the Article tools work this quarter. However, the main menu will likely still be not accessible when it is "pinned" but that's probably acceptable.
Fixing the collapsed TOC would be more involved and would likely require JS. The existing behavior will probably still need to be maintained for no-js users on smaller viewports, so there will be additional CSS complexity from maintaining two approaches to the collapsed TOC.

@Volker_E @ovasileva My recommendation is to close this task for now, with the understanding that the main menu and collapsed TOC will be inaccessible for the release. The longer term fixes can be included in other tasks.

@bwang - would this only be the case once both are collapsed? If the main menu is collapsed by default (as it is for logged-out users), this would be the case as well, right?

Yes that's right, the issue listed in this task (the landmarks being hidden) only occurs when they are collapsed. To clarify though, this is just one aspect of the accessibility of the main menu and collapsed TOC and there are other related issues with these two UI elements (i.e. T313447).

Given our conversation from grooming, we can close this as this will be fixed as part of T317899 and T318013