Skip to content

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

Open
@majornista

Description

@majornista

🐛 Bug Report

A non-modal popover allows page and popover to scroll even when the target is fixed.

The new documentation search box feature in development includes a SearchAutocomplete combo box in a page header that has position: fixed

  1. Open https://reactspectrum.blob.core.windows.net/reactspectrum/d5aed9e2838b40d54ba7e7ba7a7a77f8fec212c6/docs/react-spectrum/index.html
  2. Enter some characters to search into the SearchAutocomplete, which should open a popover displaying the results.
  3. With the popover open, use the mouse wheel to scroll the page.

🤔 Expected Behavior

The popover should not scroll with the underlying page, but should remain positioned relative to the SearchAutocomplete.

😯 Current Behavior

The popover scrolls with the page on top of the SearchAutocomplete contained in the page header with position: fixed.

💁 Possible Solution

isNonModal should not disable usePreventScroll at:

useLayoutEffect(() => {
if (!isNonModal && placement) {
setPositioned(true);
}
}, [isNonModal, placement]);
usePreventScroll({
isDisabled: isNonModal || !isPositioned
});

🔦 Context

💻 Code Sample

🌍 Your Environment

Software Version(s)
react-spectrum @react-aria/[email protected]
Browser All
Operating System macOS

🧢 Your Company/Team

Adobe/Accessibility

🕷 Tracking Issue (optional)

#3383

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions