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.

[Modal] Android Chrome input focus causes scroll

See original GitHub issue

Bug 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

  1. Using Android Chrome go to https://3zf6r.csb.app
  2. Scroll all the way to the bottom
  3. Click the Open Modal button
  4. In the modal select the first input
  5. 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

ezgif com-resize

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:closed
  • Created 3 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
with-heartcommented, Sep 8, 2020

I can verify that this is happening on my device as well.

2reactions
joserocha3commented, Sep 8, 2020

@with-heart thanks, man. You are super on top of everything. Thank you for confirming!

Read more comments on GitHub >

github_iconTop 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 >

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