-
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
Query Loop block: Reuse existing screen-reader-text CSS class for the enhanced pagination aria-live region #55309
Query Loop block: Reuse existing screen-reader-text CSS class for the enhanced pagination aria-live region #55309
Conversation
I'm not familir with the CSS handling of the blocks. I'm assuming the block library I do see other blocks that use the screen-reader-text-CSS class, for example: archives, categories, latest posts. As such I'm assuming this change is safe but I'd appreciate some feedback from contributors who are more familiar with the CSS engine. |
Size Change: -127 B (0%) Total Size: 1.65 MB
ℹ️ View Unchanged
|
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.
I can confirm that styles for the .screen-reader-text
class always get loaded. They are a part of the common.scss
file in
gutenberg/packages/block-library/src/common.scss
Lines 76 to 105 in eed2781
.screen-reader-text { | |
border: 0; | |
clip: rect(1px, 1px, 1px, 1px); | |
-webkit-clip-path: inset(50%); | |
clip-path: inset(50%); | |
height: 1px; | |
margin: -1px; | |
overflow: hidden; | |
padding: 0; | |
position: absolute; | |
width: 1px; | |
word-wrap: normal !important; | |
} | |
.screen-reader-text:focus { | |
background-color: $gray-300; | |
clip: auto !important; | |
clip-path: none; | |
color: #444; | |
display: block; | |
font-size: 1em; | |
height: auto; | |
left: 5px; | |
line-height: normal; | |
padding: 15px 23px 14px; | |
text-decoration: none; | |
top: 5px; | |
width: auto; | |
z-index: 100000; | |
} |
That file gets enqueued in block themes separately, and in classic themes it's a part of the
styles.scss
file which gets loaded as well.
This change makes perfect sense to me, and looks good 👍
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 @aristath confirms that the class is always loaded, it's also fine to me 🙂👍
@@ -48,7 +48,7 @@ function render_block_core_query( $attributes, $content, $block ) { | |||
$content = substr_replace( | |||
$content, | |||
'<div | |||
class="wp-block-query__enhanced-pagination-navigation-announce" | |||
class="wp-block-query__enhanced-pagination-navigation-announce screen-reader-text" |
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.
Let's also remove this class, which is unnecessary now.
class="wp-block-query__enhanced-pagination-navigation-announce screen-reader-text" | |
class="screen-reader-text" |
If someone needs it, we'll add it back.
@priethor Just a quick note that this PR is one more case where forcing a single Type label sees to not be ideal. I would have liked to set both the |
I just cherry-picked this PR to the 6.4-rc3-2 branch to get it included in the next release: 4eadbff |
* Update label for lightbox editor UI (#55724) * Update label for lightbox editor UI * Change lightbox label in Global Styles * Require queryId for enhanced pagination. (#55720) * Change pattern category taxonomy public param to false (#55748) * Query block enhanced pagination: Detect inner plugin blocks during render (#55714) * Flag inner plugin blocks inside query loop * Improve PHP logic a little * Only disallow plugin blocks and post content * Get rid of global variables * Fix returned content from render callback * Handle composed query stacks * Disable navigation on the browser * Replace `count` with `empty` * Add PHPdocs and improve var naming * Lint PHP * Clarify docs a little * Move the disable check before preventDefault * Restore previous navigate logic * Set filter priorities back to 10 * Basic inspector warnings * Make render query filter static * Add stable modal logic * Switch back to ToggleControl * Auto remove filter when query stack is empty * Add first unit tests * Switch to inverse control * Add test case for nested queries * Prevent passing `null` to the Tag Processr * Get rid of explicit auto mode and notices * Test directives in the Pagination Previous block * Minor typos and improvements * Improve modal texts * Fix WPCS * Reorder teardowns * Reset the dirty flag after it's used * Prevent usage of post content block --------- Co-authored-by: David Arenas <[email protected]> * Reuse existing screen-reader-text CSS class. (#55309) --------- Co-authored-by: Artemio Morales <[email protected]> Co-authored-by: Peter Wilson <[email protected]> Co-authored-by: Glen Davies <[email protected]> Co-authored-by: Luis Herranz <[email protected]> Co-authored-by: David Arenas <[email protected]> Co-authored-by: Andrea Fercia <[email protected]>
This second update for RC3 includes the following fixes: * [WordPress/gutenberg#55724 Update label for lightbox editor UI] - string change. * [WordPress/gutenberg#55720 Query: Require queryId for enhanced pagination to prevent PHP notices] and warnings. * [WordPress/gutenberg#55714 Query block enhanced pagination: Detect inner plugin blocks during render] - which avoids turning off enhanced pagination in TT4, includes string changes. * [WordPress/gutenberg#55309 Query Loop block: Reuse existing screen-reader-text CSS class for the enhanced pagination aria-live region]. Follow up to [57034], [56987], [56961], [56849], [56818], [56816]. Props afercia, aristath, artemiosans, czapla, darerodz, glendaviesnz, hellofromTonya, jameskoster, joen, luisherranz, mikachan, ocean90, peterwilsoncc, ramonopoly, rajinsharwar, swissspidy. Fixes #59411. Built from https://develop.svn.wordpress.org/trunk@57048 git-svn-id: http://core.svn.wordpress.org/trunk@56559 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This second update for RC3 includes the following fixes: * [WordPress/gutenberg#55724 Update label for lightbox editor UI] - string change. * [WordPress/gutenberg#55720 Query: Require queryId for enhanced pagination to prevent PHP notices] and warnings. * [WordPress/gutenberg#55714 Query block enhanced pagination: Detect inner plugin blocks during render] - which avoids turning off enhanced pagination in TT4, includes string changes. * [WordPress/gutenberg#55309 Query Loop block: Reuse existing screen-reader-text CSS class for the enhanced pagination aria-live region]. Follow up to [57034], [56987], [56961], [56849], [56818], [56816]. Props afercia, aristath, artemiosans, czapla, darerodz, glendaviesnz, hellofromTonya, jameskoster, joen, luisherranz, mikachan, ocean90, peterwilsoncc, ramonopoly, rajinsharwar, swissspidy. Fixes #59411. Built from https://develop.svn.wordpress.org/trunk@57048 git-svn-id: https://core.svn.wordpress.org/trunk@56559 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This second update for RC3 includes the following fixes: * [WordPress/gutenberg#55724 Update label for lightbox editor UI] - string change. * [WordPress/gutenberg#55720 Query: Require queryId for enhanced pagination to prevent PHP notices] and warnings. * [WordPress/gutenberg#55714 Query block enhanced pagination: Detect inner plugin blocks during render] - which avoids turning off enhanced pagination in TT4, includes string changes. * [WordPress/gutenberg#55309 Query Loop block: Reuse existing screen-reader-text CSS class for the enhanced pagination aria-live region]. Follow up to [57034], [56987], [56961], [56849], [56818], [56816]. Reviewed by davidbaumwald , jorbin. Merges [57048] to the 6.4 branch. Props afercia, aristath, artemiosans, czapla, darerodz, glendaviesnz, hellofromTonya, jameskoster, joen, luisherranz, mikachan, ocean90, peterwilsoncc, ramonopoly, rajinsharwar, swissspidy. Fixes #59411. git-svn-id: https://develop.svn.wordpress.org/branches/6.4@57049 602fd350-edb4-49c9-b593-d223f7449a82
This second update for RC3 includes the following fixes: * [WordPress/gutenberg#55724 Update label for lightbox editor UI] - string change. * [WordPress/gutenberg#55720 Query: Require queryId for enhanced pagination to prevent PHP notices] and warnings. * [WordPress/gutenberg#55714 Query block enhanced pagination: Detect inner plugin blocks during render] - which avoids turning off enhanced pagination in TT4, includes string changes. * [WordPress/gutenberg#55309 Query Loop block: Reuse existing screen-reader-text CSS class for the enhanced pagination aria-live region]. Follow up to [57034], [56987], [56961], [56849], [56818], [56816]. Reviewed by davidbaumwald , jorbin. Merges [57048] to the 6.4 branch. Props afercia, aristath, artemiosans, czapla, darerodz, glendaviesnz, hellofromTonya, jameskoster, joen, luisherranz, mikachan, ocean90, peterwilsoncc, ramonopoly, rajinsharwar, swissspidy. Fixes #59411. Built from https://develop.svn.wordpress.org/branches/6.4@57049 git-svn-id: http://core.svn.wordpress.org/branches/6.4@56560 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Fixes #55303
What?
screen-reader-text
CSS class already provided by the block library common CSS.Why?
We should always use the recommended, WordPress standard, CSS ruleset for visually hidden content.
We should not use redundant unnecessary CSS.
How?
Removes the custom unnecessary ruleset and reuses the
screen-reader-text
CSS class from the block library common CSS.Testing Instructions
wp-block-query__enhanced-pagination-navigation-announce
.screen-reader-text
.screen-reader-text
CSS class in the block librarycommon.css
.Testing Instructions for Keyboard
Screenshots or screencast