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

Prevent the browser from auto-scrolling the scroll container on spacebar #16047

Merged
merged 1 commit into from Oct 31, 2017

Conversation

Projects
None yet
1 participant
@nathansobo
Contributor

nathansobo commented Oct 31, 2017

Fixes #16046

When the user is typing in the editor, we prevent the insertion of all characters into the hidden input except spaces. If we prevent the default action of space insertion, then the spacebar is interpreted by the browser as a request by the user to page down, so we have to insert it. Unfortunately, if the input is off screen, inserting a space causes the browser to attempt to scroll it into view. Since we implement our own scrolling, this causes content to become hidden.

This PR forces the scrollTop and scrollLeft of the scroll container back to 0 after typing a space in the editor. Often this will do nothing, but sometimes it will correct for the browser's auto-scroll behavior which we didn't want in the first place.

@nathansobo nathansobo merged commit 7ff38ac into master Oct 31, 2017

3 checks passed

ci/circleci Your tests passed on CircleCI!
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@nathansobo nathansobo self-assigned this Oct 31, 2017

@nathansobo nathansobo deleted the prevent-browser-autoscroll-on-space branch Oct 31, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment