-
Notifications
You must be signed in to change notification settings - Fork 18
Improve the functionality of aria-pressed
attribute in button elements
#517
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.
By adding aria-pressed
attribute you mark the button as a toggle button.
Your proposal adds this attribute to every button and not all buttons are toggle buttons.
Buttons that are toggle buttons: bold, highlight, list, link.
Buttons that are not toggle buttons: undo, image, remove format.
47b3bff
to
a848522
Compare
a848522
to
5edce86
Compare
I've modified existing behaviour, which has added I see 2 ways how to achieve that:
Both approaches require multiple changes in many repositories, that's why I'd like to have sure that the chosen solution will be better. As the first one seems to be a little bit better for me, that's why I've prepared some sample solution: @oleq can you give me feedback related to this case? Which approach seems to be better for this case or maybe there is some other way? // cc @mlewand |
BTW we already have a The only issue is that IMHO switch button implies a slightly different semantics than toggle button. Toggle button for me is more of a boolean state, always on/off, while switch button sounds like a choice between two values, e.g. "wide/narrow", "black/white", "black/pink" etc. |
This sounds like overkill for me. To force the switch button, which inheritance from the button, to have a different visual form which will look like a regullar button but with defined I think better could be to have the Button class with configuration option |
KISS. Cake recipe:
We don't need new constructor arguments. We incline towards observables in the project because one can change them during the life cycle of the component. We don't need additional clas chains like |
Ad 2. |
When the |
That's correct, we must not add 'aria-pressed': bind.to( 'isOn', value => this.isToggleable ? String( value ) : false ) I'm not proficient yet with this API but my understanding is that if
My suggestion was not necessarily add another class here. Nonetheless additional property is ok. |
Just to make things clear, buttons that are not toggleable (like undo, redo, etc.) should not have
via https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/button_role. It looks like the "Print page" button in this example confirms my assumptions. |
…chbutton constructor. Correct unit test related to chanegs.
Yes, regular buttons must not have The |
I add observable |
Suggested merge commit message (convention)
Fix: Improve the functionality of
aria-pressed
attribute in button elements. Closes ckeditor/ckeditor5#1403.Additional information
sub-pr: