Prevent “half screen” bug by resetting scroll position when editor regains focus #798
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.
Identify the Bug
See #191.
Description of the Change
Pulsar uses a hidden
input
element to receive keyboard input in text editors.When this hidden element is outside the current viewport, sometimes the browser tries to scroll a container that isn't meant to be scrolled in order to bring it into view. This doesn't make sense because of how we handle scrolling, so it's always the wrong thing to do, even though the browser's just trying to be helpful.
Atom used to handle this by explicitly resetting the container's
scrollTop
andscrollLeft
to0
after the hidden input was focused, but this PR changed that behavior because of a mistaken belief that it wouldn't be needed anymore.Alternate Designs
You can read about other possible fixes in #191. I think we settled on this one because it's just restoring a fix that Atom used to have, so it's less risky than trying a novel approach that might introduce new regressions.
Possible Drawbacks
I honestly doubt that there are any. If this code caused any problems, it wouldn't have been previously present in Atom.
Verification Process
Perform the reproduction steps in #191 and verify that the issue no longer occurs.
Release Notes
Fixed an issue that sometimes caused text to shift or disappear after an editor pane regains focus.