Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: prevent browser from scrolling when panning #4489

Merged
merged 2 commits into from
Dec 27, 2021
Merged

Conversation

dwelle
Copy link
Member

@dwelle dwelle commented Dec 27, 2021

When the component is inside a scrollable container, panning via space-drag or wheel-drag causes the container to scroll.

@dwelle dwelle requested a review from ad1992 December 27, 2021 12:53
@vercel
Copy link

vercel bot commented Dec 27, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/excalidraw/excalidraw/3eMNYppE4XfDCxxT8Lmp61FaAaEv
✅ Preview: https://excalidraw-git-fixscrollingdefault-excalidraw.vercel.app

@@ -1765,6 +1765,7 @@ class App extends React.Component<AppProps, AppState> {
if (event.key === KEYS.SPACE && gesture.pointers.size === 0) {
isHoldingSpace = true;
setCursor(this.canvas, CURSOR_TYPE.GRABBING);
event.preventDefault();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

technically we should prevent only when handleKeyboardGlobally == false, but for this use case it should be fine

@ad1992
Copy link
Member

ad1992 commented Dec 27, 2021

changelog ?

@dwelle dwelle merged commit bae0e98 into master Dec 27, 2021
@dwelle dwelle deleted the fix_scrolling_default branch December 27, 2021 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants