Skip to content

Commit

Permalink
Change right-click video menu to left-click (#10548)
Browse files Browse the repository at this point in the history
* Change right-click video menu to left-click

* Update e2e test
  • Loading branch information
bvaughn authored May 31, 2024
1 parent cb4ae84 commit c8d7a65
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 16 deletions.
5 changes: 5 additions & 0 deletions packages/e2e-tests/helpers/comments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@ export async function addVisualComment(
async () => {
const element = page.locator("#graphics");
await element.click({ position: { x, y } });

await selectContextMenuItem(page, {
contextMenuItemTestName: "ContextMenuItem-AddComment",
contextMenuTestId: "ContextMenu-Video",
});
},
"visual",
text
Expand Down
12 changes: 2 additions & 10 deletions src/ui/components/Video/Video.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,7 @@ export default function Video() {
const dispatch = useAppDispatch();
const panel = useAppSelector(getSelectedPrimaryPanel);

const { addComment, contextMenu, onContextMenu } = useVideoContextMenu();

const onClick = (event: MouseEvent) => {
dispatch(stopPlayback());

if (nodePickerStatus == "disabled") {
addComment(event);
}
};
const { contextMenu, onContextMenu: onClick } = useVideoContextMenu();

const showBeforeAfterTestStepToggles = panel === "cypress";

Expand All @@ -124,7 +116,7 @@ export default function Video() {
<ReplayLogo size="sm" color="gray" />
</div>

<img className={styles.Image} id="graphics" onClick={onClick} onContextMenu={onContextMenu} />
<img className={styles.Image} id="graphics" onClick={onClick} />

{/* Graphics that are relative to the rendered screenshot go here; this container is automatically positioned to align with the screenshot */}
<div className={styles.Graphics} id="overlay-graphics">
Expand Down
6 changes: 0 additions & 6 deletions src/ui/components/Video/useVideoContextMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,6 @@ export default function useVideoContextMenu() {
}, [contextMenu, hideMenu, isPlaying]);

return {
addComment: (e: React.MouseEvent) =>
addComment({
pageX: e.pageX,
pageY: e.pageY,
position: getPositionForAddingComment(e),
}),
contextMenu,
onContextMenu,
};
Expand Down

0 comments on commit c8d7a65

Please sign in to comment.