-
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
Fixed : Modal dialog: small improvement for elementShouldBeHidden #65941
Merged
afercia
merged 11 commits into
WordPress:trunk
from
vk17-starlord:fix/Modal-dialog-#65829
Oct 14, 2024
Merged
Changes from 3 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
19f6c91
Fixed : Modal dialog: small improvement for elementShouldBeHidden #65829
vk17-starlord c105ad6
Refactor `elementShouldBeHidden` to combine all checks into a single …
vk17-starlord 1f359cd
Added : PR description in changelog.md
vk17-starlord c20a22b
Removed comments from function and fixed changelog
vk17-starlord a16631b
Removed modal details from bug fixes and moved to enhancements
vk17-starlord 47d6ff1
Add missing empty line to changelog.
afercia 0b8c530
Merge branch 'trunk' into fix/Modal-dialog-#65829
vk17-starlord 249987d
Merge branch 'WordPress:trunk' into fix/Modal-dialog-#65829
vk17-starlord ab50e42
moved : PR details to enhancement section
vk17-starlord 8c2cd31
Merge branch 'trunk' of https://github.com/vk17-starlord/gutenberg in…
vk17-starlord ed93710
Add missing empty line to changelog.
afercia File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,11 +45,16 @@ export function modalize( modalElement?: HTMLDivElement ) { | |
*/ | ||
export function elementShouldBeHidden( element: Element ) { | ||
const role = element.getAttribute( 'role' ); | ||
|
||
// Combine the conditions into a single return statement | ||
return ! ( | ||
element.tagName === 'SCRIPT' || | ||
element.hasAttribute( 'aria-hidden' ) || | ||
element.hasAttribute( 'aria-live' ) || | ||
( role && LIVE_REGION_ARIA_ROLES.has( role ) ) | ||
( | ||
element.tagName === 'SCRIPT' || // Skip <script> tags | ||
element.hasAttribute( 'hidden' ) || // Skip elements with 'hidden' attribute | ||
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
); | ||
} | ||
|
||
|
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.
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.
The changelog entry should follow a specific format:
- PR
.Enhancements
section as it's not a bug fix.