Closed
Description
Feature Request
Ionic version:
[x] 4.10
Describe the Feature Request
Add a way to figure out if the checked
value of ion-toggle
was changed by user interaction or programatically.
Describe Preferred Solution
Add a new property to the event object or the detail
property.
Describe Alternatives
- Add a new event (e.g.
ionUserChange
) that only fires on user interaction. - Add the original event to
detail
.
All of these solutions could be expanded to other components.
Related Code
Same request: #17123
Additional Context
My use case: I have a dark mode toggle and on ionChange
I save the user's preference. Until the user manually sets the toggle I use the OS setting (which I get using window.matchMedia('(prefers-color-scheme: dark)')
). When the OS setting changes the toggle should change as well. But this saves the new value and no longer checks the OS preference.