Added aria label to the button block with icon#38966
Conversation
| type="button" | ||
| className={ buttonClasses } | ||
| style={ buttonStyles } | ||
| aria-label={ label ? label : __( 'Search' ) } |
There was a problem hiding this comment.
@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.
@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.
Committed, please review.
|
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. |
Description
Testing Instructions
Screenshots
Types of changes
Checklist:
*.native.jsfiles for terms that need renaming or removal).