[Block: Search] Add a visually hidden label #35034
Conversation
Thanks @carolinan for the PR!
I tested, and this looks to work as expected.
A minor note, I noticed that now '<label for="%s" class="wp-block-search__label screen-reader-text">%s</label>',
is duplicated 3 times, and the code to generate the markup is fairly similar for all 4 of the labels.
It might be worth considering storing the pattern or making a helper function for generation of the label markup.
I went ahead and approved because it works as is, and readability with the above is a matter of opinion. Figured I'd leave the note, though, so you can make a decision on whether to optimize this more.
I did that because we can't place the if statement inside the |
Definitely, however you prefer! |
I do agree its not optimized, but I don't know how else to do it. |
I think I found an alternative method which should simplify the code and conditions a lot... I submitted a PR against your branch in #35337 so merging that here will update this PR accordingly. Unless I missed something, I believe the logic there is the same as what we're doing here |
* simplify conditions Co-authored-by: George Mamadashvili <[email protected]>
Description
Closes #34989
Adds a visually hidden label to the search block when the label is toggled off or the label text is removed.
How has this been tested?
Types of changes
Bug fix
Checklist:
*.native.js
files for terms that need renaming or removal).The text was updated successfully, but these errors were encountered: