Skip to content

Commit 73d2b2e

Browse files
authored
fix(player): prevent buttons from submitting a parent form (#974)
1 parent 72030a2 commit 73d2b2e

12 files changed

Lines changed: 13 additions & 9 deletions

File tree

packages/react/src/components/ui/buttons/caption-button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const CaptionButton = React.forwardRef<HTMLButtonElement, CaptionButtonProps>(
3737
return (
3838
<CaptionButtonBridge {...(props as Omit<CaptionButtonProps, 'ref'>)}>
3939
{(props) => (
40-
<Primitive.button type="button" {...props} ref={composeRefs(props.ref, forwardRef)}>
40+
<Primitive.button {...props} ref={composeRefs(props.ref, forwardRef)}>
4141
{children}
4242
</Primitive.button>
4343
)}

packages/react/src/components/ui/buttons/fullscreen-button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const FullscreenButton = React.forwardRef<HTMLButtonElement, FullscreenButtonPro
3737
return (
3838
<FullscreenButtonBridge {...(props as Omit<FullscreenButtonProps, 'ref'>)}>
3939
{(props) => (
40-
<Primitive.button type="button" {...props} ref={composeRefs(props.ref, forwardRef)}>
40+
<Primitive.button {...props} ref={composeRefs(props.ref, forwardRef)}>
4141
{children}
4242
</Primitive.button>
4343
)}

packages/react/src/components/ui/buttons/live-button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const LiveButton = React.forwardRef<HTMLButtonElement, LiveButtonProps>(
3838
return (
3939
<LiveButtonBridge {...(props as Omit<LiveButtonProps, 'ref'>)}>
4040
{(props) => (
41-
<Primitive.button type="button" {...props} ref={composeRefs(props.ref, forwardRef)}>
41+
<Primitive.button {...props} ref={composeRefs(props.ref, forwardRef)}>
4242
{children}
4343
</Primitive.button>
4444
)}

packages/react/src/components/ui/buttons/mute-button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const MuteButton = React.forwardRef<HTMLButtonElement, MuteButtonProps>(
4242
return (
4343
<MuteButtonBridge {...(props as Omit<MuteButtonProps, 'ref'>)}>
4444
{(props) => (
45-
<Primitive.button type="button" {...props} ref={composeRefs(props.ref, forwardRef)}>
45+
<Primitive.button {...props} ref={composeRefs(props.ref, forwardRef)}>
4646
{children}
4747
</Primitive.button>
4848
)}

packages/react/src/components/ui/buttons/pip-button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const PIPButton = React.forwardRef<HTMLButtonElement, PIPButtonProps>(
3636
return (
3737
<PIPButtonBridge {...(props as Omit<PIPButtonProps, 'ref'>)}>
3838
{(props) => (
39-
<Primitive.button type="button" {...props} ref={composeRefs(props.ref, forwardRef)}>
39+
<Primitive.button {...props} ref={composeRefs(props.ref, forwardRef)}>
4040
{children}
4141
</Primitive.button>
4242
)}

packages/react/src/components/ui/buttons/play-button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const PlayButton = React.forwardRef<HTMLButtonElement, PlayButtonProps>(
3535
return (
3636
<PlayButtonBridge {...(props as Omit<PlayButtonProps, 'ref'>)}>
3737
{(props) => (
38-
<Primitive.button type="button" {...props} ref={composeRefs(props.ref, forwardRef)}>
38+
<Primitive.button {...props} ref={composeRefs(props.ref, forwardRef)}>
3939
{children}
4040
</Primitive.button>
4141
)}

packages/react/src/components/ui/buttons/seek-button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const SeekButton = React.forwardRef<HTMLButtonElement, SeekButtonProps>(
3737
return (
3838
<SeekButtonBridge {...(props as Omit<SeekButtonProps, 'ref'>)}>
3939
{(props) => (
40-
<Primitive.button type="button" {...props} ref={composeRefs(props.ref, forwardRef)}>
40+
<Primitive.button {...props} ref={composeRefs(props.ref, forwardRef)}>
4141
{children}
4242
</Primitive.button>
4343
)}

packages/react/src/components/ui/buttons/toggle-button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const ToggleButton = React.forwardRef<HTMLButtonElement, ToggleButtonProps>(
3535
return (
3636
<ToggleButtonBridge {...(props as Omit<ToggleButtonProps, 'ref'>)}>
3737
{(props) => (
38-
<Primitive.button type="button" {...props} ref={composeRefs(props.ref, forwardRef)}>
38+
<Primitive.button {...props} ref={composeRefs(props.ref, forwardRef)}>
3939
{children}
4040
</Primitive.button>
4141
)}

packages/vidstack/src/components/ui/buttons/live-button.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ export class LiveButton extends Component<LiveButtonProps> {
5454
protected override onAttach(el: HTMLElement): void {
5555
setAttributeIfEmpty(el, 'tabindex', '0');
5656
setAttributeIfEmpty(el, 'role', 'button');
57+
setAttributeIfEmpty(el, 'type', 'button');
5758
el.setAttribute('data-media-tooltip', 'live');
5859
}
5960

packages/vidstack/src/components/ui/buttons/seek-button.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ export class SeekButton extends Component<SeekButtonProps> {
5757
protected override onAttach(el: HTMLElement) {
5858
setAttributeIfEmpty(el, 'tabindex', '0');
5959
setAttributeIfEmpty(el, 'role', 'button');
60+
setAttributeIfEmpty(el, 'type', 'button');
6061
el.setAttribute('data-media-tooltip', 'seek');
6162
setARIALabel(el, this._getLabel.bind(this));
6263
}

0 commit comments

Comments
 (0)