react-spectrum
react-spectrum copied to clipboard
chore: Revert "Revert "fix: scrollIntoView should respect scroll-margin (#8715)""
This PR refactors scrollIntoView and scrollIntoViewport to support scrollMargin, while working around the regressions mentioned in https://github.com/adobe/react-spectrum/issues/8689#issuecomment-3429792206. Additionally, a new inline & block option for alignment of a container element has been added.
By leveraging bounding rectangles, the internal calculations are now streamlined with DOMLayoutDelegate and significantly simplified.
✅ 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