Skip to content

Conversation

@hasegawa-101
Copy link

Closes #9199

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

Comment on lines 126 to 128
// if (width > documentElement.clientWidth) {
// width = documentElement.clientWidth;
// }
Copy link
Contributor

Choose a reason for hiding this comment

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

This should probably be rounded to account for sub-pixel differences when zooming.

Copy link
Member

Choose a reason for hiding this comment

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

shouldn't it be ceil? or floor? I don't quite follow what the concern is here though

also, this doesn't need to be an if, can be

width = Math.min(Math.round(width), documentElement.clientWidth)

Copy link
Contributor

@nwidynski nwidynski Dec 4, 2025

Choose a reason for hiding this comment

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

Concern were false-positives in general. I did not take a deeper look at the underlying issue before, but in this case false-positives could result in a tiny gap between the overlay and scrollbar, right? Maybe that's acceptable though - certainly better than cutting content off 🤷

On Firefox & Chrome the clientWidth appears to correspond to Math.round, but Safari apparently uses some other heuristic, neither floor nor ceil.

@hasegawa-101 hasegawa-101 marked this pull request as ready for review December 4, 2025 17:24
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.

scrollbar-gutter: stable interferes with Popover positioning (MacOS)

3 participants