question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Select component is scrolling to top of page after selecting item

See original GitHub issue

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 😯

Since I have a component select, after I select an option the component kind of loses the reference and scrolls to the top of the page even applying the MenuProps

<Select onChange={( e: ChangeEvent<{ name?: string | undefined; value: unknown }> ) => onChange(e.target.value, e.target.name, index)} value={item.selected} MenuProps={{ anchorOrigin: { vertical: 'bottom', horizontal: 'left' }, transformOrigin: { vertical: 'top', horizontal: 'left' }, getContentAnchorEl: null }} > {item?.materials?.map((c) => ( <MenuItem key={c?.name} value={c?.name}> {c?.name} </MenuItem> ))} </Select>

Expected behavior 🤔

The ideal scenario would be after selecting the option to keep the reference in the same place on the page and not scroll

Steps to reproduce 🕹

Steps:

  1. Open the options that make up the select
  2. Select an option
  3. It will end up scrolling to the top of the page after that.

Context 🔦

I have a multiple component scenario on the screen where some of them are selectable, and when the user selects an option there is a scroll to the top of the page. And that’s a bad experience for the user.

Your environment 🌎

`npx @mui/envinfo`
  Don't forget to mention which browser you used.
  Output from `npx @mui/envinfo` goes here.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

6reactions
marrcommented, Dec 13, 2021

@caioorg What was the outcome here? I see you closed the issue with no explanation.

Thanks

1reaction
brichisoncommented, Nov 23, 2022

This issue still exists.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Select component is scrolling to top of page after selecting item
Steps: Open the options that make up the select; Select an option; It will end up scrolling to the top of the page...
Read more >
Scrolling select element jumps to top when removing options ...
If you scroll down the list and double click an item to move, the select list will scroll up to the top when...
Read more >
overscroll-behavior - CSS: Cascading Style Sheets | MDN
The overscroll-behavior CSS property sets what a browser does when reaching the boundary of a scrolling area.
Read more >
Scroll to the top of the page using JavaScript/jQuery
In jQuery, the scrollTo() method is used to set or return the vertical scrollbar position for a selected element. This behavior can be...
Read more >
Preserve scroll position in prototypes - Figma Help Center
If they click on an object, Figma will load Screen 2 at the top of the frame. The user will then have to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found