Skip to content

fix: Support range sliders in usePreventScroll on iOS#9506

Merged
yihuiliao merged 2 commits intoadobe:mainfrom
mattvague:bug/fix-usePreventScroll-for-range-inputs
Jan 26, 2026
Merged

fix: Support range sliders in usePreventScroll on iOS#9506
yihuiliao merged 2 commits intoadobe:mainfrom
mattvague:bug/fix-usePreventScroll-for-range-inputs

Conversation

@mattvague
Copy link
Contributor

@mattvague mattvague commented Jan 19, 2026

Closes #9493

✅ Pull Request Checklist:

  • Included link to corresponding React Spectrum GitHub Issue.
  • Added/updated unit tests and storybook for this change (for new code or code which already has tests).
  • Filled out test instructions.
  • Updated documentation (if it already exists for this component)
  • Looked at the Accessibility Practices for this feature - Aria Practices

📝 Test Instructions:

  • Open Storybook and go to usePreventScroll story on iOS device
  • Tap "Click Me in safari and then scroll"
  • Should be able to drag thumbs of range slider
image

@mattvague mattvague marked this pull request as ready for review January 19, 2026 16:54
@mattvague
Copy link
Contributor Author

mattvague commented Jan 19, 2026

I made a quick attempt at writing some iOS specs for usePreventScroll but hit this CSS parsing issue:

image

I suspect it's an issue with the usage of @layer but not sure

@mattvague
Copy link
Contributor Author

mattvague commented Jan 19, 2026

I also signed the CLA after seeing that failure if someone wants to re-run

Copy link
Member

@snowystinger snowystinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. This is going to be tricky. I went to the story in the testing instructions, and if i vertically drag, starting on the slider, then I can scroll the page, which is not intended.

@devongovett were you ok with that as a potential side effect? It seems uncommon that people wouldn't stumble on it.

I'm a little unclear on when precisely this is an issue. Where is usePreventScroll being used that it's blocking a range input in your application? It shouldn't be a problem if the input is inside a modal which is most of the cases where scrolling is prevented.

@snowystinger
Copy link
Member

try to refresh CLA bot

@devongovett devongovett changed the title Support range sliders in usePreventScroll on iOS fix: Support range sliders in usePreventScroll on iOS Jan 26, 2026
@devongovett
Copy link
Member

@snowystinger there are already cases where we cannot prevent scroll such as text selection. This is another edge case we need to allow. I don't think it's possible to be completely perfect unfortunately.

@yihuiliao yihuiliao added the RAC label Jan 26, 2026
@yihuiliao yihuiliao added this pull request to the merge queue Jan 26, 2026
Merged via the queue into adobe:main with commit f738a38 Jan 26, 2026
33 of 34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

usePreventScroll breaks range inputs on iOS

4 participants