-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Added aria label to the button block with icon #38966
Added aria label to the button block with icon #38966
Conversation
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.
@Sisanu Thanks for the PR. Please see my comment below. Otherwise, looking great.
@@ -257,6 +257,7 @@ export default function SearchEdit( { | |||
type="button" | |||
className={ buttonClasses } | |||
style={ buttonStyles } | |||
aria-label={ label ? label : __( 'Search' ) } |
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.
@Sisanu Probably going to want to make this buttonLabel. Need to figure out how to remove all the HTML tags though. Not sure if we have package for it or not.
import { __unstableStripHTML } from '@wordpress/dom';
That may be safe to use. I saw another PR get merged using it. Still I am unsure why it is marked unstable.
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.
@alexstine, are you aiming for something like this? As far as I understand we have a buttonText
attribute.
aria-label={ buttonText ? stripHTML( buttonText ) : __( 'Search' ) }
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.
@Sisanu Yes.
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.
Committed, please review.
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.
Thanks for working on this! The only thing I'd mention is that we're using the I think it'd be good if the same attribute could be used in both places. |
@talldan Nice catch. I totally thought we were using buttonText in that other PR, but guess not. This is super confusing. Should buttonText be used in both places since it is an aria-label for the button? If not, I am sure one quick commit can switch back to label for this PR. Sorry for the confusion, I just don't understand very well how this side of the editor works and tries to tie in with old WordPress search. |
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.
Thanks @Sisanu - the changes look good now.
Description
Testing Instructions
Screenshots
Types of changes
Checklist:
*.native.js
files for terms that need renaming or removal).