Feat ion toggle toggle event#19509
Conversation
|
I am not convinced about adding random APIs across inputs, we need to solve the problem for all inputs at once, and ship a consistent API for all components. Maybe it could be a prop of ionChange itself, like "userInteraction" or "trigger" |
|
This actually would be great and solve so many problems. Should I open an issue for that? |
|
@manucorporat I'm wondering if the "trigger" would be good to add to all events for interactive components? I could see this being useful on |
|
This event should probably also be emitted when the state is changed by dragging. This might also be useful for |
|
Thanks for the PR! We appreciate the work you put into creating this. After discussing with the team, we have decided not to accept this PR. This is similar to #20106. We feel it would be best to provide a way to differentiate between programmatic and user generated I am going to close this PR. Thanks! |
Pull request checklist
Please check if your PR fulfills the following requirements:
npm run build) was run locally and any changes were pushednpm run lint) has passed locally and any fixes were made for failuresPull request type
Please check the type of change your PR introduces:
What is the current behavior?
The
ionChangeevent will be emitted as soon as the toggle's value changes, whether that is because the toggle is being toggled manually or the value changes otherwise, programatically for example. At the moment from theionChangeevent there is no way to determine if the value change happened manually or automatically.This is basically the same issue as mentioned in PR #19097 for ion-checkbox.
What is the new behavior?
This PR adds the
ionToggleevent which is only emitted when the toggle actually is being toggled by the user.Does this introduce a breaking change?
Other information
--