ensure Switch has type="button" (#192)
Closes: #178 Co-authored-by: =?UTF-8?q?Oskar=20L=C3=B6fgren?= <islander.abroad@gmail.com> Co-authored-by: =?UTF-8?q?Oskar=20L=C3=B6fgren?= <islander.abroad@gmail.com>
This commit is contained in:
@@ -117,6 +117,10 @@ export function Switch<TTag extends React.ElementType = typeof DEFAULT_SWITCH_TA
|
||||
onKeyPress: handleKeyPress,
|
||||
}
|
||||
|
||||
if (passThroughProps.as === 'button') {
|
||||
Object.assign(propsWeControl, { type: 'button' })
|
||||
}
|
||||
|
||||
return render({ ...passThroughProps, ...propsWeControl }, propsBag, DEFAULT_SWITCH_TAG)
|
||||
}
|
||||
|
||||
|
||||
@@ -74,6 +74,10 @@ export const Switch = defineComponent({
|
||||
onKeyPress: this.handleKeyPress,
|
||||
}
|
||||
|
||||
if (this.$props.as === 'button') {
|
||||
Object.assign(propsWeControl, { type: 'button' })
|
||||
}
|
||||
|
||||
return render({
|
||||
props: { ...this.$props, ...propsWeControl },
|
||||
slot,
|
||||
|
||||
Reference in New Issue
Block a user