Skip to content
This repository was archived by the owner on Nov 3, 2023. It is now read-only.

Commit ac842d0

Browse files
committed
fix(components/Controls): add stop propagation to buttons
1 parent a22a19d commit ac842d0

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

src/components/Controls.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,15 @@ export const { MenuSliderControl } = await webpack.waitForModule<{
3333
export function Icon(props: {
3434
className?: string;
3535
onClick?: (event: React.MouseEvent) => void;
36+
onContextMenu?: (event: React.MouseEvent) => void;
3637
path: string;
3738
}): JSX.Element {
3839
return (
3940
<svg
4041
className={toClassNameString('icon', props.className)}
4142
viewBox='0 0 24 24'
42-
onClick={props.onClick}>
43+
onClick={props.onClick}
44+
onContextMenu={props.onContextMenu}>
4345
<path fill='currentColor' d={props.path} />
4446
</svg>
4547
);
@@ -210,11 +212,11 @@ export const Controls = (props: ControlsComponentProps): JSX.Element => {
210212
return (
211213
<div
212214
ref={containerRef}
213-
className={toClassNameString('controls-container', props.shouldShow.current ? '' : 'hidden')}
214-
onContextMenu={(e: React.MouseEvent): void => e.stopPropagation()}>
215+
className={toClassNameString('controls-container', props.shouldShow.current ? '' : 'hidden')}>
215216
<Icon
216217
className={toClassNameString('shuffle-icon', props.shuffle ? 'active' : '')}
217218
path={mdiShuffle}
219+
onContextMenu={(e: React.MouseEvent): void => e.stopPropagation()}
218220
onClick={(event: React.MouseEvent): void =>
219221
events.emit<ShuffleInteraction>('controlInteraction', {
220222
event,
@@ -226,6 +228,7 @@ export const Controls = (props: ControlsComponentProps): JSX.Element => {
226228
<Icon
227229
className='skip-prev-icon'
228230
path={mdiSkipPrevious}
231+
onContextMenu={(e: React.MouseEvent): void => e.stopPropagation()}
229232
onClick={(event: React.MouseEvent): void =>
230233
events.emit<SkipPrevInteraction>('controlInteraction', {
231234
event,
@@ -238,6 +241,7 @@ export const Controls = (props: ControlsComponentProps): JSX.Element => {
238241
<Icon
239242
className='play-pause-icon'
240243
path={props.playing ? mdiPause : mdiPlay}
244+
onContextMenu={(e: React.MouseEvent): void => e.stopPropagation()}
241245
onClick={(event: React.MouseEvent): void =>
242246
events.emit<PlayPauseInteraction>('controlInteraction', {
243247
event,
@@ -249,13 +253,15 @@ export const Controls = (props: ControlsComponentProps): JSX.Element => {
249253
<Icon
250254
className='skip-next-icon'
251255
path={mdiSkipNext}
256+
onContextMenu={(e: React.MouseEvent): void => e.stopPropagation()}
252257
onClick={(event: React.MouseEvent): void =>
253258
events.emit<SkipNextInteraction>('controlInteraction', { event, type: 'skipNext' })
254259
}
255260
/>
256261
<Icon
257262
className={toClassNameString('repeat-icon', props.repeat !== 'off' ? 'active' : '')}
258263
path={props.repeat !== 'track' ? mdiRepeat : mdiRepeatOnce}
264+
onContextMenu={(e: React.MouseEvent): void => e.stopPropagation()}
259265
onClick={(event: React.MouseEvent): void =>
260266
events.emit<RepeatInteraction>('controlInteraction', {
261267
event,

0 commit comments

Comments
 (0)