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

Allow RemoveScroll to be disabled in Select component #1496

Closed
neilff opened this issue Jun 30, 2022 · 12 comments
Closed

Allow RemoveScroll to be disabled in Select component #1496

neilff opened this issue Jun 30, 2022 · 12 comments

Comments

@neilff
Copy link

neilff commented Jun 30, 2022

Feature request

We're curious if you'd consider allowing the RemoveScroll component to be disabled within the Select component.

Overview

Our users have reported that it causes confusing behavior by removing the scroll bar. I'm curious what the reasoning was for this component to be used? I might be missing a larger a11y issue that I haven't considered here.

I noticed that the RemoveScroll API exposes an enabled prop (as well as a removeScrollBar prop) of which might allow this to be toggled: https://github.com/theKashey/react-remove-scroll#usage

Examples in other libraries

N/A

Who does this impact? Who is this for?

All users

@neilff neilff closed this as completed Jun 30, 2022
@neilff neilff reopened this Jun 30, 2022
@neilff
Copy link
Author

neilff commented Jun 30, 2022

I attempted to quickly expose this prop in a PR but realized there is more work required to fix the positioning issue that arises 🤔

Screen Cast 2022-06-30 at 8 42 19 AM

Regardless, I'm curious to understand if there is a reasoning to not go down this path, otherwise I can try to piece something together.

@benoitgrelard
Copy link
Collaborator

Hi @neilff, the component currently only supports modal mode (as opposed to others like Popover which supports both modal/non-modal).

Modal mode means no interaction outside the layer, and that includes scrolling.

The main reason for not supporting both yet in Select is the complexity of the positioning combined with outside scroll support. The plan is to support non-modal mode (which subsequently would allow scrolling outside) but the select would close when you do so (we do this with tooltips too).

@maurocolella
Copy link

Hi @benoitgrelard . This was closed as completed on Jul 1, 2022, but I am unclear on how to enable or implement non-modal mode.

The desired effect for me is to keep the scrollbar visible, and just close the modal once the user wheels away, or scrolls away somehow.

@joaom00
Copy link
Contributor

joaom00 commented Jul 6, 2023

Hi @maurocolella,

that is not implemented yet. Hopefully, will be addressed by #2253. However, that PR only adds the non modal mode to the popper position.

@maurocolella
Copy link

Thank you for your reply @joaom00 . It seems reasonable to limit it to the popper position (this is how I am using the component).

In the meantime, I will simply override the implementation with a detailed comment (remove the RemoveScroll wrapper for my own purpose).

@FanManutd
Copy link

FanManutd commented Dec 25, 2023

It helped me:

useEffect(() => {
    if (shown) {
      document.body.style.setProperty('overflow-y', 'auto', 'important');
    } else {
      document.body.style.removeProperty('overflow-y');
    }
  }, [shown]);

Unfortunately, this does not enable the scroll, but only shows it (which allows you to remove the content shift).

@Railly
Copy link

Railly commented Feb 25, 2024

If you're using scrollbar-gutter: stable;, you can add this bunch of css to get rid of the shift.

  html body[data-scroll-locked] {
    --removed-body-scroll-bar-size: 0 !important;
    margin-right: 0 !important;
  } 

@ColeBlender
Copy link

I have my select in a modal so when I click the select it disables the modal. I just want clicking the select to have no effect on the modal. Can this be done with the current library?

@CodingAleCR
Copy link

Why is this closed if the issue is still happening and the MR for modal stuff isn't merged?

@danny-avila
Copy link

Why is this closed if the issue is still happening and the MR for modal stuff isn't merged?

Wondering the same

@QuocThuanTruong
Copy link

This issue is really annoying :(

@VietNguyenR
Copy link

Sorry for digging an old thread but better than asking a duplicate question, any new update related to this?

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

No branches or pull requests