-
Notifications
You must be signed in to change notification settings - Fork 3.8k
feat: Fix ARIA roles and setup for fields (experimental) #9384
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Fix ARIA roles and setup for fields (experimental) #9384
Conversation
This also provides the basis for generalized field typing and labeling support for high-quality labels.
|
Note to self: maybe check shortcuts since that could allow #9313 to possibly be addressed, too. |
|
Keyboard nav test failure is happening due to https://github.com/google/blockly-keyboard-experimentation/blob/30c5286ee0910c2795c1c93bbf440ed5ab1b3953/test/webdriverio/test/block_comment_test.ts#L39 being a bit fragile with directly using a generated ID that can easily change (such as in this PR since more IDs are being generated). That test will need to be updated outside of this PR. |
…#745) RaspberryPiFoundation/blockly#9384 revealed that one of the Block comment tests was a bit fragile in directly validating a specific node ID. Since node IDs can change if new elements on the page require a generated ID, the test could easily fail with changes to core Blockly. This PR fixes the issue by using a regex check instead of a direct ID match. The 'comment_textarea' part is _probably_ sufficiently unique for the test to be considered correct (though it is possible for the wrong comment to be focused here, but it seems really unlikely with how simple the test is being set up and, if that actually happened, it's sort of incidentally still correct as there would be _some_ comment that has focus). This PR also includes a number of attempts to improve test stability (particularly in CI): - It introduces a CI-specific command that adds a 30 second Mocha test timeout to provide a lot more time for tests to fail (since CI tends to run on less performant machines than used for development). - It introduces a synchronization between the Mocha timeout and the timeout used for WebdriverIO's `waitFor*` functions. Note that this actually will usually be 60 seconds regardless of the configured Mocha timeout due to the way the hook is set up. However, this is still far better than the 5 second default as at least 1 test seemed to fairly regularly fail against that limit. - It adds a few missing 'wait' calls for helpers that are performing side effects which ensures better synchronization when using `PAUSE_TIME` (and possibly better stability when running in CI, too, though it's unclear of `pause()` actually does anything when the provided timeout is 0). - See #745 (comment) attempts to further stabilize OS X tests only to yield that there are actual test failures. This will be merged into the screen reader experimental branch to unblock the core Blockly PR as well. #746 has been filed to track the discovered test failures.
BenHenning
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Self-review.
|
Also, if there's any way you could attach a video demo to this PR, that would help a lot, as I find it difficult sometimes to know exactly what's being read out based on the roles and state. Like somewhere the actual value should be read out, which doesn't seem to be explicitly in any of the manually-set roles, so the video would help me make sense of how it all fits together. Or, in lieu of that, writing out a couple of examples. |
BenHenning
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Self-reviewed latest changes.
Also, if there's any way you could attach a video demo to this PR, that would help a lot, as I find it difficult sometimes to know exactly what's being read out based on the roles and state. Like somewhere the actual value should be read out, which doesn't seem to be explicitly in any of the manually-set roles, so the video would help me make sense of how it all fits together. Or, in lieu of that, writing out a couple of examples.
I've been trying to minimize videos since they can be time consuming (especially doing good ones), but I did add a quickly made one to the PR description outlining most of the changes in the PR which hopefully helps add some context. I realize it's difficult especially for a PR like this that's affecting so much at one time.
|
Everything that was addressed seems largely non-controversial, so I don't think another review pass is needed. The more tricky comments were either closed without further action needed, or tracked in new locations so that they can be addressed outside of this PR. |
3cf834a
into
RaspberryPiFoundation:add-screen-reader-support-experimental
The basics
The details
Resolves
Fixes #8206
Fixes #8210
Fixes #8213
Fixes #8255
Fixes #8211
Fixes #8212
Fixes #8254
Fixes part of #9301
Fixes part of #9304
Proposed Changes
This PR completes the remaining ARIA roles and properties needed for all core fields. Specifically:
activedescendantproved very useful in ensuring that the current dropdown selection is correctly read when the combobox has focus but its menu isn't opened.activedescendantto represent the current value selection.FieldDropdown) improvements explained above. However one additional bit was done to provide an explicit 'Variable ' readout for the purpose of clarity. This demonstrates some contextualization of the value of the field which may be a generally useful pattern to copy in other field contexts.imageARIA role is already being used. Now only the alt text is supplied along with the role context. Note that images need special handling since they can sometimes be navigable (such as when they have click handlers).textelement since this will show up as aStaticTextnode in the accessibility tree and automatically be read as part of the field's value.valueminandvaluemaxARIA properties have been removed. It seems these are really only useful when introducing a slider mechanism (see https://www.w3.org/WAI/ARIA/apg/patterns/slider/) and from testing seems to not really be utilized for the basic text input thatFieldNumbercurrently uses. It may be the case that this is a better pattern to use in the future, but it's more likely that other custom fields could benefit from more specific patterns like slider rather thanFieldNumberbeing changed in that way.Note that it doesn't cover external fields (such as those supplied in blockly-samples), nor does it fully set up the infrastructure work for those. Ultimately that work needs to happen as part of #9301.
Beyond the role work above, this PR also introduces some fundamental work for #9301. Specifically:
Reason for Changes
Generally the initial approach for implementing labels is leveraging as specific ARIA roles as exist to directly represent the element. This PR is completing that work for all of core Blockly's built-in fields, and laying some of the groundwork for generalizing this support for custom fields.
Having specific roles does potentially introduce inconsistencies across screen readers (though should improve consistency across sites for a single screen reader), and expectations for behaviors (like shortcuts) that may need to be ignored or only partially supported (#9313 is discussing this).
Test Coverage
Only manual testing has been completed since this is experimental work.
Video demonstrating most of the changes:
Screen.recording.2025-10-01.4.05.35.PM.webm
Documentation
N/A -- Experimental work.
Additional Information
This has only been tested on ChromeVox.