Prevent focusing inputs from causing page to scroll offscreen #819
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.
Summary
Currently if you eg have the sequence field in the design browser part way offscreen and then paste a long sequence, if will cause the entire page to shift offscreen. This prevents that from happening
Implementation Notes
By default, browsers move the page so that a focused input (and more specifically, your cursor) is in view. This makes sense, as you want to make sure you see what you're doing, and a keyboard user may be tabbing through input fields which should scroll into view, etc. However: a) scrolling the page is not actually what we want - we haven't actually drawn content there that's just sitting offscreen, it's only "virtually" in our scene and we'd actually need to redraw the scene and b) we have overflow: hidden on our root game element, which means that there is no good way to scroll the content back into view. Additionally, it may be in a ScrollContainer which has it clipped, which means it may not even show the input at all.
Arguably in some situations we should find a way to implement this behavior - eg, in a scroll container, we should just scroll the scroll container. However this is nontrivial, so will leave this to a future enhancement and limit this work to fixing the buggy behavior. See #820.
This patch also removes the input masking hack since we no longer need to support the misbehaving WebKit version, and that was getting in the way of debugging this issue.