Skip to content

[PER-10593] Reset page scroll on public gallery navigation#1019

Open
aasandei-vsp wants to merge 1 commit into
mainfrom
PER-10593-scrool-gallery-to-top
Open

[PER-10593] Reset page scroll on public gallery navigation#1019
aasandei-vsp wants to merge 1 commit into
mainfrom
PER-10593-scrool-gallery-to-top

Conversation

@aasandei-vsp
Copy link
Copy Markdown
Contributor

When navigating into a sub-folder in a public archive, the page kept the parent view's scroll position so users landed at the bottom of the new sub-folder rather than the top. Reset window scroll to (0, 0) on every NavigationEnd inside PublicComponent so each folder load starts at the top.

Issue: PER-10593

When navigating into a sub-folder in a public archive, the page kept the
parent view's scroll position so users landed at the bottom of the new
sub-folder rather than the top. Reset window scroll to (0, 0) on every
NavigationEnd inside PublicComponent so each folder load starts at the top.

Issue: PER-10593
@aasandei-vsp aasandei-vsp self-assigned this May 11, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 50.03%. Comparing base (937b84b) to head (3ba853a).
⚠️ Report is 16 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1019      +/-   ##
==========================================
+ Coverage   49.88%   50.03%   +0.14%     
==========================================
  Files         348      348              
  Lines       11501    11501              
  Branches     1974     1974              
==========================================
+ Hits         5737     5754      +17     
+ Misses       5576     5560      -16     
+ Partials      188      187       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Member

@cecilia-donnelly cecilia-donnelly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This didn't work for me. I went to the public view of an archive with a lot of content (locally). I scrolled to the bottom of the front page (local equivalent of https://app.permanent.org/p/archive/03dg-0000) and entered a folder. Then I was still at the bottom of the page inside the folder. I rebuilt the web-app from docker, but maybe there's something else I should do to make sure this is getting picked up?

@aasandei-vsp
Copy link
Copy Markdown
Contributor Author

@cecilia-donnelly Hmmm, I deployed it on dev as well and it worked for me, but maybe I fixed it in a different place than the one you/the ticket expects it.

The steps I followed:

  1. In the private workspace, create a folder with a lot of content and some subfolders
  2. Single click(select) the folder
  3. Select the Publish action from the top of the menu
  4. Click the publish button from the modal
  5. Click the "View on web" button from the new modal or copy the generated link
  6. The folder should load, so scroll to the bottom of the page and click a folder
    EXPECTED: The subfolder will load and the page will scroll to the top.

Please let me know if this is the right place for the fix or if there are different steps that I need to follow.

@cecilia-donnelly cecilia-donnelly self-requested a review May 18, 2026 14:11
Copy link
Copy Markdown
Member

@cecilia-donnelly cecilia-donnelly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worked for me on dev so I probably had some problem with local not picking up the changes correctly. 🤷‍♀️ Sorry for the delay!

@cecilia-donnelly cecilia-donnelly added the QA This issue is ready for QA / user acceptance testing label May 18, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 18, 2026

QA Instructions

QA Testing Instructions for PR PER-10593: Reset Page Scroll on Public Gallery Navigation


Summary

This PR fixes an issue where navigating into a sub-folder in the public gallery retains the scrollbar position of the parent view, causing users to land at the bottom of the new folder instead of the top. The solution ensures that the browser scroll resets to (0, 0) after every NavigationEnd event in the PublicComponent.


Test Environment Setup

Use the default development environment. Ensure that the following prerequisites are met:

  1. The public gallery feature is accessible through the application.
  2. Make sure the repository is up-to-date, and this branch is checked out locally for testing.

Test Scenarios

1. Verify Scroll Reset on Folder Navigation

  1. Open the public gallery in the application.
  2. Scroll down to the bottom of the current folder (e.g., a parent folder).
  3. Click to navigate into a sub-folder within the public gallery.
  4. Expected Result: Upon navigating to the sub-folder, the browser window should scroll to the top (no content from the sub-folder should be hidden from view).

2. Verify Scroll Retention Upon Page Refresh

  1. Open the public gallery and navigate to a specific folder, scrolling down to a position where the scrollbar is not at the top.
  2. Refresh the page.
  3. Expected Result: Upon refresh, the page should retain its position in the currently visible folder and should not automatically scroll to the top.

3. Verify Scroll Reset on Navigating Back to the Public Gallery

  1. Open the public gallery.
  2. Navigate into a sub-folder.
  3. Scroll down the page in the sub-folder.
  4. Use the browser's Back button to navigate back to the parent folder.
  5. Expected Result: The parent folder's content should load, and the browser scroll should reset to the top of the parent folder.

4. Verify Navigation Continuity

  1. Open the public gallery and navigate between multiple sub-folders (e.g., Parent Folder → Sub-folder A → Sub-folder B).
  2. Verify that the scrollbar resets to the top upon loading each sub-folder.
  3. Check that all clicked folders load correctly without any unexpected errors.
  4. Expected Result: Page scroll resets to the top on each navigation step, and all folders load as expected.

5. Verify Functionality Across Browsers

Test the above scenarios in the following browsers to ensure cross-browser compatibility:

  • Google Chrome
  • Mozilla Firefox
  • Microsoft Edge
  • Safari (if applicable)

Regression Risks

The fix could impact the following areas:

  1. PublicComponent's router handling: Changes were made to the navigation behavior, so ensure this doesn't introduce any misbehavior in related functionality like navigation events (NavigationStart, NavigationEnd) or asynchronous routing.
  2. Other components reusing or subclassing navigation logic (if any exist).

Things to Watch For

  1. Edge Case for Deep Linking: If a user enters a direct URL to a specific sub-folder, verify that the page automatically starts at the top of the folder.
  2. Performance Impact: Ensure that adding the window.scrollTo(0, 0) doesn't introduce performance lags during navigation, especially for large galleries with many sub-folders.

Feel free to reach out if you encounter unexpected behavior.


Generated by QA Instructions Action

Copy link
Copy Markdown
Member

@omnignorant omnignorant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, this is mostly working but maybe not on Firefox? But it was mostly working on Firefox.

Here's how I broke it on Firefox:

  1. Nav here: https://app.dev.permanent.org/p/archive/065t-0000/065t-00uj/325929
  2. scroll to bottom click on "XXX Chickens Level 2" folder (the XXX is just to force it to the bottom of the page 🤪 )
  3. I observe no scroll up

@aasandei-vsp
Copy link
Copy Markdown
Contributor Author

aasandei-vsp commented May 21, 2026

@omnignorant Hmm, that is really strange. I'm sorry, but I didn't manage to reproduce it. I have tried the exact scenario in Firefox and it worked for me. I used the build on dev that's already using this branch. This is a video of what I have seen:
https://www.loom.com/share/69e81c69602948ffaa2e8e250d58a2e4

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

Labels

QA This issue is ready for QA / user acceptance testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants