-
Notifications
You must be signed in to change notification settings - Fork 25
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
feat: button toggle: Allow consumer to control pressed state #5143
Conversation
Thanks for the PR! 🎉 We've deployed an automatic preview for this PR - you can see your changes here:
Note The build needs to finish before your changes are deployed. |
@@ -36,4 +37,65 @@ describe('button-toggle', () => { | |||
|
|||
}); | |||
|
|||
describe('consumer manages state', () => { |
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.
These feel like they might be better suited to normal unit tests that just assert that the value of elem.pressed
is what you're expecting.
@@ -2,6 +2,7 @@ import { css, html, LitElement } from 'lit'; | |||
|
|||
/** | |||
* A button container component for button toggles. | |||
* @fires click - Internal event |
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.
It doesn't seem possible to @ignore
our new click event since it's assigned to a variable, so this is our hack for not showing it in the docs (see this)
🎉 This PR is included in version 3.66.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Since this ends up triggering the |
I was thinking you might have to add a classInitializer and manage things from there instead of wiring up their functions to |
Jira ticket
Problem:
Previously in the MVC toggle control, the on click event could happen prior to the pressed state being changed. With the switch to the component, that no longer happens. This was found to be an issue in discussions, where the consumer needs to click the button > accept a dialog > then the state should change.
Fix notes:
This allows the consumer to manage the state rather than managing the state through a click handler. Let me know alternative ideas and also alternative property names. I wasn't sure if there was another property with a similar function to model the name off of.Removed new property and switched to an event approach insteadTo do: