Testing the switch attribute
switch is a boolean attribute valid only on <input type="checkbox">. When present, it renders the checkbox as an on/off switch rather than a traditional checkbox, and the browser exposes it to assistive technology with role="switch" automatically, no ARIA required. The underlying behaviour doesn't change, it's still a checkbox for form submission purposes, and a switch never supports the indeterminate state that an ordinary checkbox can.
This is a newer HTML feature with still-evolving browser support. Unsupported browsers silently ignore the attribute and render an ordinary checkbox instead, worth confirming directly which of your standard browsers and screen readers actually recognise it.
Default
A standard checkbox, no switch attribute, included for comparison.
HTML markup
<input id="switch-default" type="checkbox">
<label for="switch-default">Enable notifications</label>
Switch present
The same checkbox with the switch attribute added. Where supported, this changes its visual appearance to an on/off switch and its accessible role to switch instead of checkbox, automatically.
HTML markup
<input id="switch-present" type="checkbox" switch>
<label for="switch-present">Enable notifications</label>