-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
[ToggleButton] Improve customizability #17187
[ToggleButton] Improve customizability #17187
Conversation
Details of bundle changes.Comparing: 7b6a14b...93c4408
|
Hey, not sure what I should do about the argos failure. |
e191c2d
to
1e9e655
Compare
1e9e655
to
8daea9c
Compare
@simshaun I have done an extra commit with the following diffs:
|
We had a demo in v0 of a checkbox with custom icons as a pseudo toggle-button, but if the styling of this one suits, then fair enough I suppose! The styling looks wrong with a transparent background, but, as you say, could be misconstrued as selected with one. That says to me this component isn't the best tool for the job, since it isn't what it was designed for. If these changes have other benefits, then probably still worth applying. |
In my actual use-case, my app's design makes heavy use of transparent BG controls, so the transparency works fine (for me). Honestly, trying to use the checkbox component didn't even cross my mind... I had a group of toggle buttons and then wanted to add a standalone toggle button off to the side that looks the same as the others. I didn't make the mental leap to "this is basically a checkbox with a different icon/text". I guess as long as I can make it look like the toggle buttons without much difficulty, this PR isn't really necessary. Though, if ToggleButton shouldn't be used standalone, maybe some sort of warning or tip in the docs/console could be handy to ward off misuse. |
The color tool swatch checkboxes use restyled RadioButtons, which are a peer of the checkbox (based on the same underlying component), so it's not inconceivable. I'm assuming that since @oliviertassinari has supported this PR, that he is in favour of the changes. I'm wondering if removing the demo, while leaving the other changes would strike a balance between explicitly supporting the use case, vs. "it just so happens to work"? |
I don't have any specific preference. However, I think that this discussion is a good opportunity to define the steps ahead. I have done the following benchmark:
They all seem to:
What do you guys think, are you happy with the above path forward? |
Sounds good to me.
I think you just found a use-case for the vertical separator 😄. |
Good idea. I was reading up on aria-pressed and it got me wondering about the appropriate markup for ToggleButtonGroup and children. This is likely worthy of a new, separate issue to flesh out details. e.g. Determine the best way to mark up ToggleButtonGroup and ToggleButton(s) in each scenario:
https://www.w3.org/WAI/PF/aria/roles
I'm looking at https://material.io/components/buttons/#toggle-button and I don't think a background-color is required per se. Only that "a toggle button’s state makes it clear which button is active." One of the examples they give are these standalone heart icon toggles. In the following example, the toolbar is essentially transparent (white on white). So, I don't think the background matters as long as it's clear when a button is active. |
Thanks |
Fixes #17144
Fixes #17145
Also improves documentation on individual usage of ToggleButton.