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
refactor(switch): update component #480
base: ts
Are you sure you want to change the base?
Conversation
Thank you for following the naming conventions! 🙏 |
a67d3cc
to
095ea6b
Compare
watchEffect(() => { | ||
const input = inputRef.value! | ||
const inputProto = window.HTMLInputElement.prototype | ||
const descriptor = Object.getOwnPropertyDescriptor(inputProto, 'checked') as PropertyDescriptor | ||
const setChecked = descriptor.set | ||
|
||
if (prevChecked.value !== checked.value && setChecked) { | ||
const event = new Event('click', { bubbles: bubbles.value }) | ||
setChecked.call(input, checked.value) | ||
input.dispatchEvent(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.
bubble-input does not bubble up checked change, I'm not sure if there is an issue here or not.
if (isFormControl.value) { | ||
// TODO: isPropagationStopped() is not supported in vue | ||
// hasConsumerStoppedPropagationRef.value = event.isPropagationStopped() | ||
|
||
// if switch is in a form, stop propagation from the button so that we only propagate | ||
// one click event (from the input). We propagate changes from an input so that native | ||
// form validation works and form events reflect switch updates. | ||
if (!hasConsumerStoppedPropagationRef.value) | ||
event.stopPropagation() | ||
} |
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.
or the bubble up events issue is related to this.
Description
Linked Issues
cc #358
Additional context