kobalte icon indicating copy to clipboard operation
kobalte copied to clipboard

Dialog prevents page scaling with scroll

Open maciek50322 opened this issue 5 months ago • 3 comments

Describe the bug When dialog is opened you can't scale page using CTRL + Wheel. It is possible only when dialog has it's own scrollbar and there's room to scroll, meaning:

  • You scrolled to top of dialog, now you can't increase the scale of page using CTRL + Wheel, but you can reduce scale by scrolling the other way.
  • You scrolled to bottom of dialog, now you cant reduce the scale of page using CTRL + Wheel, but you can increase scale by scrolling the other way.

To Reproduce Steps to reproduce the behavior:

  1. Go to https://kobalte.dev/docs/core/components/dialog#example
  2. Click on "Open" to open dialog
  3. Scroll up or down with CTRL
  4. Page doesn't scale

Expected behavior Page should scale as without dialog (or dialog with available space to scroll).

Desktop:

  • OS: [Windows]
  • Browser [Chrome]

maciek50322 avatar Aug 13 '25 12:08 maciek50322

This is troubling to consider, because browser and OS behavior around shortcuts like this seem to have historically been a bit 'how ya goin' 🦘

https://stackoverflow.com/questions/51515484/chrome-latest-v68-zoom-page-using-ctrl-scroll

https://www.reddit.com/r/MacOS/comments/u3naol/mac_equivalent_of_ctrlmouse_scroll_to_zoom_in_a/

Not sure what way the authors would go, I would suggest using the keyboard and mouse solid-primitives to enable the behavior if its critical though.

shayanhabibi avatar Sep 16 '25 09:09 shayanhabibi

solid-prevent-scroll is in charge of this. It would need to detect browsers that support ctrl-scroll and not block that interaction.

The Kobalte component is also blocking pinch gesture zoom, which can be fixed by adding

        createPreventScroll({
                element: () => ref ?? null,
                enabled: () => context.contentPresent() && context.preventScroll(),
+               allowPinchZoom: true,
        });

james-tindal avatar Oct 19 '25 17:10 james-tindal

This should really be done with CSS instead.

james-tindal avatar Oct 19 '25 21:10 james-tindal