Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.x]: Element index source sidebar scrolls to the top when index content is loaded #12523

Closed
mmikkel opened this issue Jan 11, 2023 · 3 comments
Assignees

Comments

@mmikkel
Copy link
Contributor

mmikkel commented Jan 11, 2023

What happened?

Description

When an element index finishes loading content, the page (i.e. window) scrolls (i.e. jumps) to the top of the page, which is fine. However, if the index' sources sidebar is also scrolled, that too jumps to the top, along with the rest of the window. This behaviour is disorienting to the author, and makes managing content in element indexes with too-tall-for-the-viewport source sidebars, more difficult than it should be.

This happens with both assets and entries element indexes (I didn't test categories).

Below is a video demonstrating the issue in an assets element index. In the video, I'm scrolling the sources sidebar for the assets index way down to the bottom. Then, I select one of the bottom sub folders. When the selected folder's assets are loaded in, and the element index updates, the sources sidebar has its scroll position reset.

The video was captured using Microsoft Edge 108.0.1462.76 on macOS 12.6.

CleanShot.2023-01-11.at.15.43.17.mp4

Steps to reproduce

  1. Visit an element index; make sure that the index source sidebar is taller than the viewport so it is scrollable.

  2. Scroll the source sidebar to the bottom, and make the element index update by selecting a source.

Expected behavior

The scroll position for the source sidebar should be retained when the element index is updated.

Actual behavior

The source sidebar's scroll position is reset when the element index updates; i.e. the source sidebar jumps to the top along with the rest of the browser window.

Craft CMS version

4.3.6.1

PHP version

8.1.12

Operating system and version

macOS 12.6

Database type and version

10.9.3-MariaDB

Image driver and version

Imagick 3.7.0 (ImageMagick 7.1.0-52)

Installed plugins and versions

None

@i-just
Copy link
Contributor

i-just commented Jan 12, 2023

Hi, thanks for getting in touch and for the clear instructions on how to replicate this - they helped a lot!
I created a PR for it (applicable to Craft 3 and 4).

@brandonkelly
Copy link
Member

#12530 has been merged for the next Craft 3 and 4 releases.

@brandonkelly
Copy link
Member

Craft 3.7.64 and 4.3.7 have been released with that fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants