Homec4science

Save, then restore scroll position in Chrome textareas on remarkup assist

Authored by epriestley <git@epriestley.com> on Feb 19 2016, 22:41.

Description

Save, then restore scroll position in Chrome textareas on remarkup assist

Summary:
Fixes T10396. Seems like this has been around for a while (references from 2011):

http://stackoverflow.com/questions/4002312/chrome-resets-the-textarea-scroll-bar-scrolltop-when-focus-is-called
https://bugs.chromium.org/p/chromium/issues/detail?id=75072

Commenting out this focus() seemed to fix the issue locally, at the cost of not focusing.

Saving, focusing, then restoring seems to produce the correct behavior everywhere.

Test Plan:

  • In Safari, Firefox and Chrome, typed a ton of text into a remarkup area (more than the height of the area, so it has a scrollbar).
  • Selected some text near the top.
  • Clicked "B" to bold the text.
  • Scroll position remained the same in all browsers (previously: in Chrome, it changed).

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10396

Differential Revision: https://secure.phabricator.com/D15313

Details

Committed
epriestley <git@epriestley.com>Feb 19 2016, 23:55
Pushed
aubortJan 31 2017, 17:16
Parents
rPH50f910ce67ac: Always install the "icon" and "emoji" remarkup rules
Branches
Unknown
Tags
Unknown

Event Timeline

epriestley <git@epriestley.com> committed rPH7b1b146620b5: Save, then restore scroll position in Chrome textareas on remarkup assist (authored by epriestley <git@epriestley.com>).Feb 19 2016, 23:55