[Modal] Android Chrome input focus causes scroll
See original GitHub issueBug report
Describe the bug
Weird issue on Android Chrome. I have a long page and scroll down quite a bit, then open a Modal
and it has some Input
components. If I click on an input the browser scrolls down and I can no longer see the focused input.
To reproduce
- Using Android Chrome go to https://3zf6r.csb.app
- Scroll all the way to the bottom
- Click the Open Modal button
- In the modal select the first input
- You will see that the browser scrolls down the page and the input is no longer visible
Minimal reproduction
https://codesandbox.io/s/xenodochial-boyd-3zf6r (https://3zf6r.csb.app)
Expected behavior
When focusing on an input the browser should not scroll way down - the input should still be visible.
Screenshots
System information
- OS: Android (any version)
- Browser (if applies): Chrome
- Version of @chakra-ui/core: 1.0.0-rc.3
Additional context
I noticed passing blockScrollOnMount={false}
to the Modal
stops the issue from occurring, but that leads to some other issues on various browsers. Either way sounds like react-remove-scoll
has the issue or its not being configured correctly by Chakra.
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
How can I prevent the Android keyboard from auto-scrolling to ...
However, when I select a text input and the keyboard slides up, the modal's content is scrolled to the bottom, placing the selected...
Read more >Android : Scrolling issue after input focus on scrollable overlay ...
The input focus triggers a scroll to the input element. Actual result: As you can see on the provided videos, the view scroll...
Read more >Prevent the page from scrolling to an element when it is focused
For example, focusing on a text field inside a modal automatically might scroll the page to the top. There are two solutions to...
Read more >overflow - CSS: Cascading Style Sheets - MDN Web Docs
The JavaScript Element.scrollTop property may be used to scroll an HTML element even when overflow is set to hidden . Formal definition. Initial ......
Read more >Prevent Page Scrolling When a Modal is Open | CSS-Tricks
That's because modals are elements on a page just like any other. It may stay in place (assuming that's what it's meant to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I can verify that this is happening on my device as well.
@with-heart thanks, man. You are super on top of everything. Thank you for confirming!