Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix(core): fix the dropdown hidden trigger initialization #568

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

geralrodrigues
Copy link
Contributor

@geralrodrigues geralrodrigues commented Sep 23, 2024

Context
When using a screen reader, such as VoiceOver, the state of the dropdown (reduced/expanded) is not read until interaction with the element is made. The following solution is proposed to fix the issue.

What has been done

  • The trigger button is initialized on load even if it is hidden instead of waiting for an interaction with it.
  • Removed the initialization on click as it would not be necessary.
  • Fixed the dropdown test. When initializing the trigger on load, the test fails because it does not find the tabbable element. What happened is that the assignedElements and the firstTabbable didn't work properly because the trigger is a MockHTMLElement. As the test is implemented, the easiest way to fix it would be to mock what the firstTabbable returns.

What to test

  • In the dropdown section, all triggers already have the a11y attributes (aria-haspopup, aria-expanded, aria-controls) without the need to interact with the element, even the nested dropdown ( Example user menu -> Available and Nested dropdown -> Click one more time).
  • When navigating to the dropdown using a screenreader, the state (‘reduced’/‘expanded’) of the dropdown is read.

@glushkova91
Copy link
Collaborator

should fix #629

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants