fix: Right-click causes image drag on ModalMediaPreviewCarousel #3265
+13
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
When a drag on the image preview (the "modal media preview carousel") begins, check if the mouse right-click button is down. If it is down, prevent the carousel drag behavior.
This is to fix the issue where you right-click on an image to show the browser right-click menu, but the carousel thinks you're now dragging the carousel.
Videos
The video below first shows the bug on the current stable build. And then it shows the behavior on the dev build with the new code. The image is no longer dragged on right-click.
Screencast.From.2025-04-14.14-59-51.mp4
Fixes #3264
Misc Notes
Vertical dragging should probably be supressed, as well as dragging when there is only a single media component. But, to keep this PR focused, I did not try to fix those UX quirks.