Skip to content

Fix: DOMLayoutDelegate miscalculates item & visible rects #8696

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

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

nwidynski
Copy link
Contributor

@nwidynski nwidynski commented Aug 9, 2025

A Scrollport coincides with the padding box, which should not include border offset. We were calculating on offsetWidth & bounding boxes instead of clientWidth and for some reason shifted the item rect by scroll offset??

With this change, the DOM layout is now consistent with our virtualized ones 👍

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

@nwidynski nwidynski changed the title fix: subtract border width from visible rect Fix: DOMLayoutDelegate miscalculates visible rect Aug 9, 2025
@nwidynski nwidynski changed the title Fix: DOMLayoutDelegate miscalculates visible rect Fix: DOMLayoutDelegate miscalculates item & visible rects Aug 10, 2025
Comment on lines -37 to -38
x: itemRect.left - containerRect.left + container.scrollLeft,
y: itemRect.top - containerRect.top + container.scrollTop,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does anyone know why the item rect was offset by the current scroll point?

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.

1 participant