-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Modal dialog: small improvement for elementShouldBeHidden
#65829
Comments
The code could be optimized by checking whether an element already has the hidden attribute, and if so, skip applying aria-hidden="true". The current behavior is redundant, as hidden already takes care of making the element inaccessible to assistive technologies. This could be achieved by modifying the elementShouldBeHidden() function to include a condition like: javascript if (element.hasAttribute('hidden')) { should i raise PR with this change @afercia ? |
@vk17-starlord sure please do feel free to submit a PR. gutenberg/packages/components/src/modal/aria-helper.ts Lines 46 to 54 in d6a4c72
|
@afercia sure working on it |
@afercia can you check this ? |
…5941) * Fixed : Modal dialog: small improvement for elementShouldBeHidden #65829 * Refactor `elementShouldBeHidden` to combine all checks into a single return statement * Added : PR description in changelog.md * Removed comments from function and fixed changelog * Removed modal details from bug fixes and moved to enhancements * Add missing empty line to changelog. * moved : PR details to enhancement section * Add missing empty line to changelog. --------- Co-authored-by: vk17-starlord <[email protected]> Co-authored-by: afercia <[email protected]> Co-authored-by: up1512001 <[email protected]>
…5941) * Fixed : Modal dialog: small improvement for elementShouldBeHidden #65829 * Refactor `elementShouldBeHidden` to combine all checks into a single return statement * Added : PR description in changelog.md * Removed comments from function and fixed changelog * Removed modal details from bug fixes and moved to enhancements * Add missing empty line to changelog. * moved : PR details to enhancement section * Add missing empty line to changelog. --------- Co-authored-by: vk17-starlord <[email protected]> Co-authored-by: afercia <[email protected]> Co-authored-by: up1512001 <[email protected]>
…rdPress#65941) * Fixed : Modal dialog: small improvement for elementShouldBeHidden WordPress#65829 * Refactor `elementShouldBeHidden` to combine all checks into a single return statement * Added : PR description in changelog.md * Removed comments from function and fixed changelog * Removed modal details from bug fixes and moved to enhancements * Add missing empty line to changelog. * moved : PR details to enhancement section * Add missing empty line to changelog. --------- Co-authored-by: vk17-starlord <[email protected]> Co-authored-by: afercia <[email protected]> Co-authored-by: up1512001 <[email protected]>
Description
The modal dialog component uses some logic to determine what body children should be
aria-hidden
when the modal dialog is open.gutenberg/packages/components/src/modal/aria-helper.ts
Lines 23 to 54 in 559391a
Some elements are correctly filtered out as they should not get the
aria-hidden
attribute. It looks like elements with thehidden
HTML attribute could be filtered out as well, as they're already completely hidden from assistive technologies.Currentlty,
aria-hidden
is added and then removed also to these elements, which seems unnecessary:Step-by-step reproduction instructions
speak
messages have been sent to the aria-live regions.a11y-speak-intro-text
does have an HTML attributehidden
.a11y-speak-intro-text
element gets anaria-hidden="true"
attribute, which is unnecessary as the element is already hidden.hidden
HTML attribute e.g. added by plugins that don't needaria-hidden="true"
.Screenshots, screen recording, code snippet
No response
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Please confirm that you have tested with all plugins deactivated except Gutenberg.
The text was updated successfully, but these errors were encountered: