eternagame / EternaJS

Eterna game/RNA design interface
Other
12 stars 10 forks source link

Prevent focusing inputs from causing page to scroll offscreen #819

Closed luxaritas closed 2 months ago

luxaritas commented 2 months ago

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.