gutenberg icon indicating copy to clipboard operation
gutenberg copied to clipboard

Scrolling in one insert tab affects other tabs

Open aaronjorbin opened this issue 9 years ago • 4 comments

version: 0.5

Issue Overview

If I scroll in one of the insert tabs, it causes the content to be scrolled in the other tabs. See this gif:

gutenburg-scroll mov

Steps to Reproduce (for bugs)

  1. Click Insert 2.Select Blocks
  2. Scroll down
  3. Select Embeds

Expected Behavior

Each tab should scroll independently

Current Behavior

Scrolling in one tab affects the other tabs

aaronjorbin avatar Jul 17 '17 17:07 aaronjorbin

Possible solution: set element.scrollTop = 0; on the scrollable panel when switching tabs.

aduth avatar Jul 17 '17 18:07 aduth

I'm not sure it's best to have each panel always start at the top. Maybe when switching tabs we should store the position and then reset it when we go back to that tab? And maybe we only store that during the current time the insert is open?

Essentially, each time insert is clicked, it's a new session, but within a session, the tabs each act independently. If I select embed and scroll it 50%, then select Blocks and scroll that 25%, when I go back to embed it should be at 50% and if I go back to blocks it should be at 25%

aaronjorbin avatar Jul 17 '17 20:07 aaronjorbin

Personally, I'd have the expectation that changing tabs would always reset scroll to the top, even when flipping between the same tabs multiple times while the inserter is open.

aduth avatar Jul 18 '17 19:07 aduth

Ive made a fix so that while the Inserter remains open, the scroll position is retained for separate tabs if they're scrolled then switched. Once it's closed and re-opened the scroll position will start at top again. Just waiting to be added to the team and will make a PR.

tg-ephox avatar Aug 03 '17 06:08 tg-ephox