Skip to content
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

Fixed : Modal dialog: small improvement for elementShouldBeHidden #65941

Merged
merged 11 commits into from
Oct 14, 2024

Conversation

vk17-starlord
Copy link
Contributor

@vk17-starlord vk17-starlord commented Oct 8, 2024

fixes #65829

Fix: Avoid redundant aria-hidden on elements with hidden attribute

This PR updates the elementShouldBeHidden function to skip applying aria-hidden="true" to elements that already have the hidden attribute, as they are already hidden from both visual and assistive technologies. This prevents unnecessary DOM manipulations and ensures cleaner, more efficient accessibility handling.
Changes:

Added a check for the hidden attribute in the function to avoid redundant aria-hidden application.

Copy link

github-actions bot commented Oct 8, 2024

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: vk17-starlord <[email protected]>
Co-authored-by: afercia <[email protected]>
Co-authored-by: up1512001 <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Oct 8, 2024
Copy link

github-actions bot commented Oct 8, 2024

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @vk17-starlord! In case you missed it, we'd love to have you join us in our Slack community.

If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information.

@vk17-starlord vk17-starlord changed the title Fixed : Modal dialog: small improvement for elementShouldBeHidden #65829 Fixed : Modal dialog: small improvement for elementShouldBeHidden Oct 8, 2024
@up1512001 up1512001 added [Type] Enhancement A suggestion for improvement. [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Package] Components /packages/components labels Oct 10, 2024
Copy link
Member

@up1512001 up1512001 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added one suggestion please check.

Copy link
Member

@up1512001 up1512001 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@up1512001
Copy link
Member

@vk17-starlord can you please add this PR info to changelog.md, it will go under Unreleased > Bug Fixes
https://github.com/WordPress/gutenberg/blob/trunk/packages/components/CHANGELOG.md

element.hasAttribute( 'aria-hidden' ) || // Skip elements marked as aria-hidden
element.hasAttribute( 'aria-live' ) || // Skip live regions
( role && LIVE_REGION_ARIA_ROLES.has( role ) )
) // Skip elements with live region roles
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment should be moved to the appropriate line. However, I'd consider to remove all these comments because the code is pretty self-explanatory.

@@ -3,7 +3,7 @@
## Unreleased

### Bug Fixes

- `Modal` : Modal dialog small improvement for elementShouldBeHidden - PR ([#65941](https://github.com/WordPress/gutenberg/pull/65941)).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changelog entry should follow a specific format:

  • Please remove the space before the colon.
  • Please remove the - PR .
  • I'd consider to move the entry to the Enhancements section as it's not a bug fix.

Copy link
Contributor

@afercia afercia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @vk17-starlord from a code perspective lookks good to me.
I left two small comments to address minor things, please have a look when you have a chance.

@vk17-starlord
Copy link
Contributor Author

@afercia have a look at latest commit , i have implemented the suggestions you gave

@vk17-starlord vk17-starlord requested a review from afercia October 11, 2024 08:35
Copy link
Contributor

@afercia afercia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, can be merged after tests pass.

Copy link
Contributor

@afercia afercia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I spoke to soon. There's now a merge conflict in packages/components/CHANGELOG.md that needs to be solved.

@vk17-starlord
Copy link
Contributor Author

@afercia anything left to be done from my side ?

@afercia
Copy link
Contributor

afercia commented Oct 14, 2024

@afercia anything left to be done from my side ?

@vk17-starlord yes: the changelog entry must be in the Unreleased section, under Enhancements. It was probably moved down when merging trunk. Thanks for your patience.

@vk17-starlord
Copy link
Contributor Author

@afercia done with changes !!

Copy link
Contributor

@afercia afercia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM to me.
Thanks @vk17-starlord

@afercia afercia merged commit ff58388 into WordPress:trunk Oct 14, 2024
62 checks passed
@github-actions github-actions bot added this to the Gutenberg 19.5 milestone Oct 14, 2024
ciampo pushed a commit that referenced this pull request Oct 14, 2024
…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]>
karthick-murugan pushed a commit to karthick-murugan/gutenberg that referenced this pull request Nov 13, 2024
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Package] Components /packages/components [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Modal dialog: small improvement for elementShouldBeHidden
3 participants