[ISSUE#1890][Functional - Open Bot Dialog] The focus goes on the disabled controls and functioning by space/return. #1999
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Solves #1890
Description
With these changes, the PrimaryButton and LinkButton elements will be hidden to screen readers while disabled.
In the issue report, the tester says the disabled buttons close the dialogs when pressing space, this happens because the Voiceover navigation mode goes through the elements even if they are not focusable by the keyboard, so the keyboard only follows it when it lands in a focusable element, and as a disabled button is not focusable, the keyboard focus remains in the last focusable element, in the case shown by the tester is the cancel button, so when pressing space bar or enter, the cancel button is clicked. This won't keep happening as Voiceover can't navigate to the Connect button when it is disabled
Changes made
We added an attribute of
aria-hidden='true'
to the PrimaryButton and LinkButton elements when they have itsdisabled
property set to true, this way the Voiceover screen reader skips them when navigating.Testing
In the following recording, you can see an example of a LinkButton and a PrimaryButton being hidden from Voiceover while they are hidden.