-
Notifications
You must be signed in to change notification settings - Fork 841
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
Toggle components #872
Toggle components #872
Conversation
Seems to work well with voice over
This will remove the tabbability of the button itself
And their respective examples in the Buttons doc page
Not restricting toggle buttons to a particular style, only toggle groups
Curious why you overlayed the children with the input instead of wrapping it with a label tied to the hidden input (similar to https://codepen.io/CreativeJuiz/pen/BiHzp)? That would keep the pointer events on the children themselves, and as a label's permitted content is phrasing, I think all of the elements we'd want to wrap are valid children. |
I was following the convention of our |
And even further, wouldn't that require re-stying a whole new element ( |
This is rad. Very quick notes on functionality (since it all looks great stylistically) You probably want to provide some warning about accessibility on Do you think we'll need the other size for button groups? I see you're forcing it to the small size, but flipping that value it still looks like it works ok. Should we make small the default, rather than a force? I'm mostly thinking about people putting these as filter toggles next to inputs. Don't feel strongly about it, guessing you prolly thought about that part of it a bit. |
The I thought about the sizing thing too, and yeah I can go ahead and change that to just be a default. |
background-color: transparentize($color, .9); | ||
} | ||
|
||
&[class*="fill"] { |
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.
Can you explain this one with some comments.
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.
done
padding: 0 $euiSizeS; | ||
} | ||
|
||
.euiButton__text:empty { |
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.
Clever
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.
LGreatTM!
This PR creates three different components:
EuiToggle
: A generic toggling component that just overlays a checkbox (or radio) on top of the child supplied and listens for changes on this input.EuiButtonToggle
: Since supplying a standardEuiButton
to theEuiToggle
component doesn't allow for pointer events on the actual button, this component adds some extra styles to simulate the same behavior but based on the pointer events on the input instead.EuiButtonGroup
: A group ofEuiButtonToggle
s that can either allow only one selection or multiple. It also has some extra specific styles as well.Accessibility
Since each toggle is essentially just a checkbox (or radio), it requires a
label
which is added to the input viaaria-label
and this is what is read by the voiceover.I also had to add
tabIndex="-1"
to the<button>
element so that tabbing doesn't jump from input to button which doubles up on label reading.Browser checks
Fixes #293 #841