-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Only mark nav menu as dialog when open #36617
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
Closed
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -526,12 +526,17 @@ function render_block_core_navigation( $attributes, $content, $block ) { | |
| 'wp-block-navigation__responsive-container-open', | ||
| $is_hidden_by_default ? 'always-shown' : '', | ||
| ); | ||
| $plain_menu_classes = array( | ||
| 'wp-block-navigation__plain-menu', | ||
| $is_hidden_by_default ? 'always-shown' : '', | ||
| ); | ||
|
|
||
| $responsive_container_markup = sprintf( | ||
| '<button aria-expanded="false" aria-haspopup="true" aria-label="%3$s" class="%6$s" data-micromodal-trigger="modal-%1$s"><svg width="24" height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" role="img" aria-hidden="true" focusable="false"><rect x="4" y="7.5" width="16" height="1.5" /><rect x="4" y="15" width="16" height="1.5" /></svg></button> | ||
| '<button aria-haspopup="true" aria-label="%3$s" class="%6$s" data-micromodal-trigger="modal-%1$s"><svg width="24" height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" role="img" aria-hidden="true" focusable="false"><rect x="4" y="7.5" width="16" height="1.5" /><rect x="4" y="15" width="16" height="1.5" /></svg></button> | ||
| <div class="%8$s">%2$s</div> | ||
| <div class="%5$s" style="%7$s" id="modal-%1$s"> | ||
| <div class="wp-block-navigation__responsive-close" tabindex="-1" data-micromodal-close> | ||
| <div class="wp-block-navigation__responsive-dialog" role="dialog" aria-modal="true" aria-labelledby="modal-%1$s-title" > | ||
| <div class="wp-block-navigation__responsive-dialog" role="dialog" aria-modal="true" aria-label="Navigation Menu" > | ||
|
Contributor
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 text change is missing the translation function. |
||
| <button aria-label="%4$s" data-micromodal-close class="wp-block-navigation__responsive-container-close"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" role="img" aria-hidden="true" focusable="false"><path d="M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"></path></svg></button> | ||
| <div class="wp-block-navigation__responsive-container-content" id="modal-%1$s-content"> | ||
| %2$s | ||
|
|
@@ -541,11 +546,12 @@ function render_block_core_navigation( $attributes, $content, $block ) { | |
| </div>', | ||
| $modal_unique_id, | ||
| $inner_blocks_html, | ||
| __( 'Open menu' ), // Open button label. | ||
| __( 'Close menu' ), // Close button label. | ||
| __( 'Open navigation menu' ), // Open button label. | ||
| __( 'Close navigation menu' ), // Close button label. | ||
| implode( ' ', $responsive_container_classes ), | ||
| implode( ' ', $open_button_classes ), | ||
| $colors['overlay_inline_styles'] | ||
| $colors['overlay_inline_styles'], | ||
| implode( ' ', $plain_menu_classes ) | ||
| ); | ||
|
|
||
| return sprintf( | ||
|
|
||
This file contains hidden or 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
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.
If we're adding these attributes dynamically only when the modal is open, do we still need the separate set of markup for when the nav is not in overlay mode? For the front end, could we toggle them in the view script instead?