moroshko / react-autowhatever

Accessible rendering layer for Autosuggest and Autocomplete components

Home Page:http://react-autowhatever.js.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Consider to remove aria-haspopup

afercia opened this issue Β· comments

Hello. Happy to see you're focusing in developing accessible components. Thanks for this πŸ™‚

I'm not sure aria-haspopup is used properly though.

aria-haspopup is a property, not a state. It's meant to indicate if an element has a popup that appears on some user activation, regardless of the popup visibility. In other words, when there's a popup, it should always be true even when the popup is not displayed. Worth nothing with ARIA 1.1 (still a Candidate Recommendation), things will change a bit and there will be more values available.

Additionally, unless I'm missing something, worth considering a combobox shouldn't have an aria-haspopup property at all. Unfortunately, the related section on the ARIA Authoring Practices is under some re-work https://www.w3.org/TR/wai-aria-practices/#combobox and they point to the related GitHub issue: w3c/aria-practices#31

From there, you can refer to the sections that were temporarily removed (https://rawgit.com/w3c/aria-practices/master/aria-practices-DeletedSectionsArchive.html#combobox) and also to the section with general considerations about popups and drop-downs:

5.4 Popups and drop-downs
https://rawgit.com/w3c/aria-practices/master/aria-practices-DeletedSectionsArchive.html#relations_haspopup

where it's clearly stated:

Combo boxes, or drop down lists, work differently. Controls with the role combobox must contain a list of items that can be opened, usually as a drop-down. Because this is intrinsic to the functionality of a combo box, it does not need to be explicitly indicated with aria-haspopup.

@afercia Thanks a lot for such a thorough research!

Out of interest, I checked what other popular websites do, and found that:

  • Google - implements aria-haspopup with true/false values, like we do in react-autowhatever.
  • Bing and usa.gov - implement aria-haspopup which is always true, which supports your theory that it's a property, not a state.
  • Ebay - implements aria-haspopup which is always false, which seems weird.
  • Facebook, LinkedIn and Twitter- don't implement aria-haspopup, which supports your theory that it can be removed.

I wonder why Google decided to implement it this way. Any ideas?

I wonder why Google decided to implement it this way. Any ideas?

@moroshko honestly I have no idea πŸ™‚ My only (wild) guess is maybe some years ago the whole combobox pattern wasn't supported so well and adding an aria-haspopup was used as sort of fallback to communicate something appeared on the page.

For sure, it's not a state: it's a property and its value shouldn't change.

Worth noting in the new ARIA 1.1 (still a Candidate Recommendation) things are a bit different and aria-haspopup will have some new values including "listbox". However, a combobox already has an implicit aria-haspopup property so it shouldn't be explicitly set, see:
https://www.w3.org/TR/wai-aria-1.1/#combobox

Elements with the role combobox have an implicit aria-haspopup value of listbox.

@afercia Cool, let's remove aria-haspopup then.
Mind creating a PR?

@moroshko Hi!
Did I understand correctly that it should be just deleted?

@moroshko can you review #36 please