-
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
Use <button>
in EuiToggleButton
#3008
Conversation
Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually? |
Hey Anish! Thanks for getting this started! @snide Do you think we can deprecate |
<button>
in EuiToggleButton
@myasonik I'd rather not deprecate utilities unless we absolutely have to. EuiToggle is just a bare-bones utility. I don't think it's necessary to remove during this PR, but we can discuss in a different issue. |
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.
OK! Then @anishagg17, I think the changes done here should be done in EuiToggle
and then EuiToggleButton
mostly handles themeing and such.
I also just want to give you a heads up that because this PR will cause breaking changes, the EUI team will have to discuss the best way to roll this out still
labelOn?: string; | ||
labelOff?: string; |
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.
I'm not quite understanding why we need label
, labelOn
, and labelOff
.... The labels, based on the value of the toggle, should be handled by the consuming application and not this component itself.
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.
Yeah, it's maybe a bit contrived... Not sure if it was the best way to solve this. (Very open to suggestions!) Here's the thing:
If we don't change the label of the text for the button, and only rely on style to communicate that the button is toggled on or off, we need to add aria-pressed="true"|"false"
.
If we do have separate texts for each state, then we shouldn't add aria-pressed
at all.
@anishagg17 Thank you so much for starting this PR! Your work here sparked some great discussion internally. After looking at our existing Soon, I'll be writing up some docs to add to EUI on the path forward and how to recreate toggle buttons with our existing components. |
Summary
Fixes #2982
Used button instead of input element
Checklist