react-spectrum icon indicating copy to clipboard operation
react-spectrum copied to clipboard

fix(#3804): usePopover: non-modal popover allows page and popover to scroll when target has position: fixed

Open majornista opened this issue 3 years ago โ€ข 13 comments

Closes #3804

โœ… Pull Request Checklist:

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

๐Ÿ“ Test Instructions:

  1. To test behavior before any fix, open the new Storybook example for a ComboBox with fixed positioning: https://reactspectrum.blob.core.windows.net/reactspectrum/82d74597a0176141733a4c2366392f39ebe7811d/storybook/index.html?path=/story/combobox--fixed-positioning&providerSwitcher-express=false&providerSwitcher-toastPosition=bottom

  2. Expand the ComboBox and scroll the page using the mouse wheel.

  3. The listbox will scroll with the underlying content.

  4. To test the behavior with a simple fix that does not disable usePreventScroll within usePopover when isNonModal={true}, open the same Storybook example with the fix applied: https://reactspectrum.blob.core.windows.net/reactspectrum/e2856408a3291ed37397f721e22393b587b52d39/storybook/index.html?path=/story/combobox--fixed-positioning&providerSwitcher-express=false&providerSwitcher-toastPosition=bottom

  5. Expand the ComboBox and scroll the page using the mouse wheel.

  6. The page will not scroll when the Iistbox is expanded.

๐Ÿงข Your Project:

Adobe/Accessibility

majornista avatar Dec 01 '22 17:12 majornista

This build just adds the Storybook example that demonstrates the behavior before any fix has been applied.

Build successful! ๐ŸŽ‰

adobe-bot avatar Dec 01 '22 17:12 adobe-bot

This build includes a simple fix that does not disable usePreventScroll within usePopover when isNonModal={true}.

Build successful! ๐ŸŽ‰

adobe-bot avatar Dec 01 '22 17:12 adobe-bot

## API Changes

unknown top level export { type: 'identifier', name: 'Column' } unknown top level export { type: 'identifier', name: 'Column' }

adobe-bot avatar Dec 02 '22 22:12 adobe-bot

@LFDanLu I agree that we will probably need to account for targets that have or inherit position: fixed by making the overlay also have position: fixed and by taking that into account when positioning the overlay.

It's odd to me that I can scroll the list of options on the iPad in the Storybook example, yet the behavior is different in the docs.

majornista avatar Dec 05 '22 15:12 majornista

Hm, definitely weird that the storybook example works on iPad but it doesn't in the docs (maybe something to do with the storybook not being scrollable?). Maybe indicative of a bug in the usePreventScroll code since it should allow scrolling in nested scroll regions now that I'm looking at the code again

LFDanLu avatar Dec 05 '22 17:12 LFDanLu