Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Flying cursor" on Mobile Safari #233

Open
davidmfoley opened this issue Sep 26, 2016 · 3 comments
Open

"Flying cursor" on Mobile Safari #233

davidmfoley opened this issue Sep 26, 2016 · 3 comments

Comments

@davidmfoley
Copy link

Summary:

Tapping an input to focus on it in mobile safari results in the cursor and scroll position jumping to a point some distance below the input, then "flying" up to the input by scrolling.

Steps to reproduce:

  1. Visit, in mobile safari: https://reactcommunity.org/react-modal/#examples
  2. Select "Use inline styles to style" (or, probably, any other example)
  3. Tap in either input field

Expected behavior:

Focus the field without scrolling/flying.

Additional notes:

Tested on iPhone 5S/iOS 9.3.5 and iPhone 7/iOS 10

@tkh44
Copy link

tkh44 commented Sep 29, 2016

This is just a behavior that is going to happen on iOS when using fixed position elements. iOS safari will not re-render fixed position elements on scroll so you get some jank when focusing an input because the page is scrolling around.

You can somewhat get around this by adding transform: translate3d(0px, 0px, 0px) onto the modals styles, but it doesn't always work.

You can see the difference by changing position: fixed to position: absolute on the modal's styles. No more jumping around.

See here for an example: http://stackoverflow.com/questions/32875046/ios-9-safari-changing-an-element-to-fixed-position-while-scrolling-wont-paint

@ganchuhang
Copy link

Any news please...

@maxscott
Copy link

I don't know how to solve this in a react idiomatic way but I did in ember in what appears to be a related project, hope it helps @Coder77 ember-modal-dialog/issues/154

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants