Skip to content

feat(slide-toggle): prevent value change #28876

Open
@slavafomin

Description

@slavafomin

Feature Description

Hello! I'm using the slide-toggle component and I want to control when and how it's value changes. Just like controlled components in React. However, I can't find a way to do so.

When I pass a signal (not a model) to the component via [checked]="isChecked()" the value of the component continues to change once a user clicks on it (totally ignoring the fact that the symbol is not changed). This looks like a bug to me, or at least something very counter-intuitive.

Then I've tried to hook into the (change) event to manually call preventDefault() on it when the value changes, but the event object provided to the event handler doesn't have such method.

Calling preventDefault() from toggle/click event handlers doesn't have any effect as well.

What can I do to take the component under control?

Thanks.

Use Case

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    P4A relatively minor issue that is not relevant to core functionsarea: material/slide-togglefeatureThis issue represents a new feature or feature request rather than a bug or bug fix

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions