w3c / aria-practices

WAI-ARIA Authoring Practices Guide (APG)
https://www.w3.org/wai/aria/apg/
Other
1.21k stars 344 forks source link

Disclosure Menu Examples have conflicting behavior and descriptions for the `Esc` key #2830

Open corymharper opened 1 year ago

corymharper commented 1 year ago

In Example Disclosure Navigation Menu we can see the following under "Accessibility Features":

If a dropdown is open and focus is inside the navigation region, pressing Esc will close the dropdown. Moving focus out of the navigation region also closes an open dropdown. Implementing this Esc behavior is necessary to meet the WCAG 2.1 1.4.13: Content on Hover or Focus criterion.

Then under "Keyboard Support" we can see the following behavior described for the "Escape" key:

If a dropdown is open, closes it and sets focus on the button that controls that dropdown.

Both described behaviors seem to be implemented, but I'm not sure why the description of the two differing behaviors based on where focus currently is is split up in these two locations, if someone read one and not the other, they'd miss an implementation detail.

Secondly, the same things are true about Example Disclosure Navigation Menu with Top-Level Links however there is a novel bug in the implementation of the example, where if focus is on one of the top level links pressing "Escape" does nothing at all, this seems to be in conflict with the description of what should happen if you press escape while in the navigation region.

css-meeting-bot commented 10 months ago

The ARIA Authoring Practices (APG) Task Force just discussed Escape in disclosure nav menu.

The full IRC log of that discussion <jugglinmike> Topic: Escape in disclosure nav menu
<jugglinmike> github: https://github.com/w3c/aria-practices/issues/2830
<jugglinmike> Matt_King: Escape is all optional
<jugglinmike> Matt_King: I don't like the way we use the word "Dropdown" here. It doesn't seem like the right word in a disclosure because it sort of implies a menu
<jugglinmike> Matt_King: Why do we close these on blur in the disclosure? That doesn't seem right
<jugglinmike> Matt_King: Going back to our previous discussion, if you tab out, you should be able to tab back to where you were
<jugglinmike> Matt_King: This is not a menu, so tabbing is not expected to close. If you have a link, for example, and you tab away from that link, you should be able to tab back to that link. I'd be shocked if I couldn't do that
<jugglinmike> CoryJoseph: What the reporter is describing doesn't seem like a bug according to the definition of Disclosure Menu
<jugglinmike> jugglinmike: I wonder if there's a parallel with mouse users. If I hover out of the dropdown, it remains open. To the extent that the position of my cursor describes my "focus" as a mouse user, then the "close on blur" behavior seems inconsistent for keyboard users
<jugglinmike> jongund: It seems like when one menu opens, it should close the other menus. One reason people use menus is to reduce visual clutter
<jugglinmike> Matt_King: That seems reasonable to me, but you have to take an explicit action to expand the other menu
<jugglinmike> Matt_King: The issue that was reported appears to be editorial, but I'm having trouble understanding as written
<jugglinmike> Matt_King: I'll ask for clarification
<jugglinmike> Matt_King: There's also a potential bug here which might be a separate issue, but we'll see about that after we receive clarification
<jugglinmike> Zakim, end the meeting
mcking65 commented 10 months ago

@corymharper,

Re-reading this after our meeting discussion today, I think I understand your concern.

Would it address your concern if we were to change the accessibility features text to the following?

If a dropdown is open and focus is inside the navigation region, pressing Esc closes the dropdown and sets focus on the button that controls that dropdown. Moving focus out of the navigation region also closes an open dropdown.

corymharper commented 10 months ago

@corymharper,

Re-reading this after our meeting discussion today, I think I understand your concern.

Would it address your concern if we were to change the accessibility features text to the following?

If a dropdown is open and focus is inside the navigation region, pressing Esc closes the dropdown and sets focus on the button that controls that dropdown. Moving focus out of the navigation region also closes an open dropdown.

This would address the issue of documentation I think, yes. There was this second issue I mentioned that I either need clarification on or I would assume it was a bug:

Secondly, the same things are true about Example Disclosure Navigation Menu with Top-Level Links however there is a novel bug in the implementation of the example, where if focus is on one of the top level links pressing "Escape" does nothing at all, this seems to be in conflict with the description of what should happen if you press escape while in the navigation region.

The top-level links are in the navigation region, based on the documentation I would expect that if a disclosure menu was open, and focus was on a top-level link within the navigation region, when "Escape" was pressed the open disclosure menu would also close. Is this an incorrect interpretation? Currently, the disclosure menu stays open if your focus is not in the disclosure, but on a top-level link when you press "Escape".