[Masonry] Screen scrolls to top on appending new Masonry items in Firefox
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 99.1k
- Forks
- 32.5k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 106
Description
Duplicates
- I have searched the existing issues
Latest version
- I have tested the latest version
Steps to reproduce 🕹
Tip: click on the two squares icon on the top right of the preview browser in codesanbox to open a preview in your browser. Then copy the link to Chrome/Firefox to see the different behavior. (or just open the above link in both Chrome and Firefox)
Steps:
- Click on append items button at the bottom, 10 new items will be added
- Click again on append items, another 10 items will be added.
- On Chrome, no issues are observed. On Firefox, after the second click, the window scrolls to the top.
- Every time new items are added to the masonry component, the window will scroll to the top.
Current behavior 😯
Window scrolls to the top when new items are appended to the masonry component in Firefox.
Expected behavior 🤔
Scroll position doesn't change.
Context 🔦
A work around will be to disable auto scroll anchoring behavior of the browser by adding the following CSS to the masonry component:
sx={{
overflowAnchor: "none",
}}
Maybe this should be added to the component itself?
Your environment 🌎
@mui/envinfo@2.0.8
Firefox 110.0 (64-bit)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked CodeSandbox reproduction and compare appending items in Chrome and Firefox. Investigate the Masonry component's scroll behavior and the reported overflowAnchor: "none" workaround. Done means repeatedly appending items in Firefox no longer changes the window's scroll position while the existing behavior remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100