Skip to content

[Bug]: Dialog / Sheet should NOT add pointer-events: none to body tag when opened #1540

Open

Description

@titusdecali

Reproduction

https://stackblitz.com/run?file=src%2FApp.vue

Describe the bug

(Would actually like a "Discussion" tag as this isn't really a bug)

Both the Dialog and Sheet components are setting pointer-events: none to the body tag when opened. This prevents using things like lightboxes above the Sheet, or emoji pickers inside of a Dialog. I've had numerous issues with this already and just now realized the cause of the issue.

I don't think it's necessary to set this on the body tag and would likely be better not to due to these issues.
If there are edge cases, users can simply add a z-index to solve the vast majority of issues.

Would like to see some discussion about this and find a better way to cover whatever reasons there were when this was first added.

For now, I'm just manually removing it as needed, but the issue isn't at first obvious and could cause a lot of wasted time for devs.

SHOT 12 01 33@2x

System Info

"nuxt": "^3.14.1592",
"radix-vue": "^1.9.10",
"shadcn-nuxt": "^0.10.4"

Contributes

  • I am willing to submit a PR to fix this issue
  • I am willing to submit a PR with failing tests

Activity

  1. added
    bug
    on Nov 28, 2024
  2. added
    need-reproduction
    and removed
    bug
    on Nov 28, 2024
  3. sadeghbarati commented on Nov 28, 2024

    @sadeghbarati
    Collaborator

    Your Stackblitz link is not ready, you need to save the playground or fork it

  4. added
    question
    and removed
    need-reproduction
    on Dec 3, 2024
  5. artyom12211 commented on Jan 5, 2025

    @artyom12211

    +1
    It would be nice add it when needed.

  6. The73756 commented on Mar 3, 2025

    @The73756

    +1

  7. kilakewe commented on Mar 14, 2025

    @kilakewe

    This is also an issue for me. It's causing the overlay to appear to be clicked, which means that if anything that isn't an input is clicked inside the model, including whitespace, it closes.

  8. kilakewe commented on Mar 14, 2025

    @kilakewe

    Actually, I found my issue to be caused by the accidental use of ModalContent twice.

  9. tombanksme commented on Mar 25, 2025

    @tombanksme

    Howdy folks,
    I was having issues like this and figured out it was caused by having some components on radix-vue and some components on reka-ui. These packages are not compatible and using components from each of them will result in some strange behaviour.

    If you're using the shadcn-vue library it's a pretty simple fix. Just update all of your components using npx shadcn-vue@latest add <component> and then remove the radix-vue dependency from your package.json

    Hope this helps!

  10. kieran-artworker commented on Apr 23, 2025

    @kieran-artworker

    I am also running into a problem with this.

    I am unsure what the motivation is behind adding pointer-events: none to the document body. It is coming from the packages/core/src/shared/useBodyScrollLock.ts composable.

    If the intention is to lock scrolling, then I think adding overflow: hidden to the body style should be sufficient?

    I would be happy to create a PR if that is desired. Removing one line ought to be simple enough.

  11. spaceemotion commented on Apr 23, 2025

    @spaceemotion

    @kieran-artworker that won't work for our use case.

    however, i am surprised that a scroll lock is not added to the dialogue background instead of the body? 🤔

  12. SoslanZS commented on May 5, 2025

    @SoslanZS

    Has anyone managed to solve the problem? I also tried what @tombanksme suggested. Unfortunately, it didn't help me.

    I temporarily solved the problem by hanging on body
    pointer-events: none !important;
    But this is the solution that I would like to use.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    question

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions