Emit Unprefixed Events for Form Controls #1758
Replies: 2 comments 6 replies
-
Considering how events are retargeted to the host element, I'm curious to know if this already works for simpler controls such as And while it might work for simple controls, I imagine it will lead to retargeted events triggering false positives in more complex cases. For example, color picker has an internal input for entering a color manually. This means every keystroke emits a retargeted input event with the value of said input (not the color picker's actual value). Internal form control values aren't guaranteed to be the same as the host element's value, so this is just one example where I can see this causing problems. |
Beta Was this translation helpful? Give feedback.
-
Yep! That's exactly what we do for our complex components like the date picker. We stop the propagation of the internal input element events so we can emit them with our scoped events. For simpler components, you could allow the native events to bubble as long as they are consistent with your scoped events. |
Beta Was this translation helpful? Give feedback.
-
Has the team tried emitting unprefixed/unscoped events for framework integration? If you emit unprefixed events in addition to your prefixed events (
input
andchange
), this should allow Vue'sv-model
and Angular'sngModel
to bind to thevalue
property.These don't need to be documented and developers don't need to be aware they exist, but the frameworks should be able to detect these and update values appropriately.
Beta Was this translation helpful? Give feedback.
All reactions