Skip to content

HTML switch control #1063

@ramiy

Description

@ramiy

Description

HTML form control that implement native switch functionality using checkboxes. It adds a switch attribute to the input element with a checkbox type.

<input type=checkbox switch>
<input type=checkbox switch checked>

Introduced in Safari 17.4 - https://webkit.org/blog/15054/an-html-switch-control/

It uses the accent-color property and the experimental ::thumb and ::track pseudo-elements. But even without the pseudo-elements, a native switch control replaces lots of CSS and JS currently used by developers.

Native switcher is also accessible by default, as the logic is inherited from the checkbox. We no longer need to implement different patterns for accessibility.

Image

Specification

https://www.w3.org/TR/wai-aria-1.3/#switch

web-feature

No response

Test Links

No response

Additional Signals

https://webkit.org/blog/15054/an-html-switch-control/

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions