Take a look at this example: https://codesandbox.io/s/spring-wood-0bikbb?file=/src/styles.css
Try this to recreate the issue:
- Click on the input at the top
- Scroll to the bottom, then click on an empty area
- Observe how the screen jumps back up to the top snap target
After investigating, I've found that these factors are contributing to the problem:
- The scroll window being over an area without a nearby snap target
- The width of the input changing when focused/unfocused
Here's what the demonstration does:
- Adds/removes a class from the container element when the input is focused/unfocused
- This class alters the width of the container
- The input container is the only element with
scroll-snap-align
applied
Question: What is causing this screen jump and how can it be prevented?