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

Property modal=False does not work as expected in drawer component #4529

Open
alisaycl96 opened this issue Dec 12, 2024 · 1 comment
Open

Comments

@alisaycl96
Copy link

Describe the bug
When declare modal=False in drawer component, it does not allow interaction outside drawer.
However, in document, it says,

When False, it allows interaction with elements outside of the drawer without closing it. Defaults to `True.

The example in the document seems not work as well. When drawer is open, page is scrollable but not able to click onto any of other element such as button on page.

To Reproduce
Steps to reproduce the behavior:

class DrawerState(rx.State):
    is_open: bool = False
    value: str = "apple"

    @rx.event
    def toggle_drawer(self):
        self.is_open = not self.is_open
 
    @rx.event
    def change_value(self, value: str):
        self.value = value



def drawer_content():
    return rx.drawer.content(
        rx.flex(
            rx.drawer.close(
                rx.button(
                    "Close",
                    on_click=DrawerState.toggle_drawer,
                )
            ),
            rx.link(
                "Link 1",
                href="#test1",
                on_click=DrawerState.toggle_drawer,
            ),
            rx.link(
                "Link 2",
                href="#test2",
                on_click=DrawerState.toggle_drawer,
            ),
            align_items="start",
            direction="column",
        ),
        height="100%",
        width="20%",
        padding="2em",
        background_color=rx.color("grass", 7),
    )


def lateral_menu():
    return rx.drawer.root(
        rx.drawer.trigger(
            rx.button(
                "Open Drawer",
                on_click=DrawerState.toggle_drawer,
            )
        ),
        rx.drawer.overlay(),
        rx.drawer.portal(drawer_content()),
        open=DrawerState.is_open,
        direction="left",
        modal=False,
    )


def drawer_sidebar():
    return rx.vstack(
        lateral_menu(),
        rx.select(
            ["apple", "grape", "pear"],
            value=SelectState.value,
            on_change=SelectState.change_value,
        ),
        rx.badge(SelectState.value),
    )

Expected behavior
When modal=False, it allows interaction with elements outside of the drawer without closing it. Defaults to `True.

Specifics (please complete the following information):

  • Python Version: Python 3.11.10
  • Reflex Version: v0.6.6
  • OS: MacOS
  • Browser (Optional): chrome
Copy link

linear bot commented Dec 12, 2024

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

1 participant