mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-11 04:48:44 +03:00
Fix bug: Don't scroll to top on click after scrolling down.
The editor has a tabindex of -1 so it can receive focus. This makes it behave like a focusable element such as a textarea. But in reality, when the editor receives focus, it just focuses the hidden input that it watches for textInput events. So when you click, focus is stolen away from the hidden input and goes to the editor. But then the editor sends focus back to the hidden input. Because the input was at the top of the screen, WebKit would scroll up to bring it on screen when focused. So now I just bring the hidden input on screen (by positioning it even with scrollTop) before focusing it. That prevents the WebKit from scrolling.
This commit is contained in:
parent
a77dd28e47
commit
8e77c05c06
@ -64,6 +64,7 @@ class Editor extends Template
|
||||
|
||||
handleEvents: ->
|
||||
@on 'focus', =>
|
||||
@hiddenInput.css(top: @scrollTop())
|
||||
@hiddenInput.focus()
|
||||
false
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user