Skip to content

Commit

Permalink
use event.nativeEvent.button to detect right click
Browse files Browse the repository at this point in the history
  • Loading branch information
dexter21767-dev committed Jul 19, 2023
1 parent 5a7c3f0 commit 0201627
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/routes/MetaDetails/VideosList/Video/Video.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ const Video = ({ className, id, title, thumbnail, episode, released, upcoming, w
const popupLabelOnContextMenu = React.useCallback((event) => {
if (!event.nativeEvent.togglePopupPrevented && !event.nativeEvent.ctrlKey) {
event.preventDefault();
if (event.nativeEvent.pointerType === 'mouse' || event.nativeEvent.button === 2) {
toggleMenu();
}
}
}, [toggleMenu]);
const popupLabelOnLongPress = React.useCallback((event) => {
if (event.nativeEvent.pointerType !== 'mouse' && !event.nativeEvent.togglePopupPrevented) {
toggleMenu();
}
}, [toggleMenu]);
Expand Down Expand Up @@ -167,6 +174,7 @@ const Video = ({ className, id, title, thumbnail, episode, released, upcoming, w
{...props}
onClick={popupLabelOnClick}
onContextMenu={popupLabelOnContextMenu}
onLongPress={popupLabelOnLongPress}
open={menuOpen}
onCloseRequest={closeMenu}
renderLabel={renderLabel}
Expand Down

0 comments on commit 0201627

Please sign in to comment.