Skip to content

Conversation

@lixiaoyan
Copy link
Contributor

@lixiaoyan lixiaoyan commented Dec 19, 2025

According to the specification, the visual viewport size excludes the scrollbar. Instead of window.innerWidth/Height, the fallback value should be document.documentElement.clientWidth/Height, which is the same as the ICB size and almost equivalent to the visual viewport size, which excludes the scrollbar.

It's mainly a fix about code correctness, as the VisualViewport is widely supported today.

See: https://drafts.csswg.org/cssom-view/#visualViewport

✅ 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:

🧢 Your Project:

@lixiaoyan
Copy link
Contributor Author

lixiaoyan commented Jan 7, 2026

Edited: I've updated the PR description.


Original post

@snowystinger This PR is primarily about correctness. It may not address any real-world issues because the VisualViewport is widely supported today.

# Conflicts:
#	packages/@react-aria/utils/src/useViewportSize.ts
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.

Team, do we care about the fallback for this?

discussed, this is fine to go in

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

Successfully merging this pull request may close these issues.

2 participants