Skip to content

Some Components don't Prevent Click Events From Bubbling #256

Description

@mad-moo

Describe the bug

Components are supposed to block events once they have been handled, but that isn't the case for all of them. Sample code (by @heizidi on discord):

Steps to Reproduce

class MyRoot(rio.Component):
    def build(self) -> rio.Component:
        return rio.PointerEventListener(
            rio.Column(
                align_y=0,
                align_x=0,
                spacing=1,
                margin=1,
                *[
                    # well-behaved, do not propagate on_press
                    rio.TextInput(),
                    rio.Button(),
                    rio.DateInput(value=date.today()),
                    rio.NumberInput(value=42),
                    rio.Switch(),
                    # Naughty, propagate on_press
                    rio.Checkbox(),
                    rio.Slider(),
                    rio.Dropdown(options=["Option 1", "Option 2", "Option 3"]),
                ],
            ),
            on_press=lambda e: print("Naughty propagator clicked!"),
        )

Screenshots/Videos

No response

Operating System

No response

What browsers are you seeing the problem on?

No response

Browser version

No response

What device are you using?

No response

Additional context

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions