Skip to content
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

Scrolling Select2 inside of Table2 causes Table2 to also scroll #5469

Open
easternmotors opened this issue Jul 27, 2022 · 3 comments
Open

Scrolling Select2 inside of Table2 causes Table2 to also scroll #5469

easternmotors opened this issue Jul 27, 2022 · 3 comments

Comments

@easternmotors
Copy link

Environment

  • Package version(s):
@blueprintjs/select: 4.5.1
@blueprintjs/table": 4.4.1
  • Operating System: Windows 10 Pro Version 21H2
  • Browser name and version: Brave Version 1.41.100 -- Chromium 103.0.5060.134 (Official Build) (64-Bit)

Code Sandbox

Minimal repro: https://codesandbox.io/s/blueprint-sandbox-forked-tbjtm1?file=/src/Table2Example.tsx

Steps to reproduce

  1. Click on one of the dropdowns
  2. Attempt to scroll down

Actual behavior

The Table scrolls and the Menu scrolls.

Expected behavior

The Table does not scroll and the Menu scrolls.

Possible solution

Not sure. I've tried a bunch of things but nothing seems to work. Settings boundary on Table's popoverProps is what I expected to initially work but it didn't. It is also weird that even if the Menu is outside of the Table bounds and you scroll, the Table still scrolls.

One note: If you change the height and width in app.css to both 100%, the Table does not scroll as expected.

@adidahiya
Copy link
Contributor

I made a small fix to your sandbox by adding in blueprint-popover2.css but this looks like a tricky issue... I think we may need to provide an option to stop propagating scroll events from inside QueryList (Select2, Suggest2, MultiSelect2) popovers... otherwise the scroll events will bubble up to the Table like they do in your example.

@rafaellichen
Copy link

rafaellichen commented Apr 13, 2023

If you add the following to the Select/Popover component, it can prevent the popover content scrolling event propagating into Table element.

// for Select2
popoverContentProps={{
    onWheelCapture: (event) => event.stopPropagation()
}}

// for Popover2
backdropProps={{
    onWheelCapture: (event) => event.stopPropagation()
}}
// or
content={
    <div onWheelCapture: (event) => event.stopPropagation() />
}

In your given example, add the following:

<FilmSelect
    ...
    popoverContentProps={{
        onWheelCapture: (event) => event.stopPropagation()
    }}
/>

For table quadrant scrolling event propagating into body element, I used the following CSS to handle it:

.bp3-table-quadrant-scroll-container {
    overscroll-behavior: contain;
}
/* https://developer.mozilla.org/en-US/docs/Web/CSS/overscroll-behavior#browser_compatibility */

@adidahiya
Copy link
Contributor

Linking to related issue: #2651

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants