mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 17:28:30 +00:00
LibWeb: Implement <input type=checkbox switch> experimentally
In conformance with the requirements of the spec PR at https://github.com/whatwg/html/pull/9546, this change adds support for the “switch” attribute for type=checkbox “input” elements — which is shipping in Safari (since Safari 17.4). This change also implements support for exposing it to AT users with role=switch.
This commit is contained in:
committed by
Sam Atkins
parent
eee90f4aa2
commit
583ca6af89
@@ -2343,13 +2343,16 @@ void HTMLInputElement::set_custom_validity(String const& error)
|
||||
|
||||
Optional<ARIA::Role> HTMLInputElement::default_role() const
|
||||
{
|
||||
// http://wpt.live/html-aam/roles-dynamic-switch.tentative.window.html "Disconnected <input type=checkbox switch>"
|
||||
if (!is_connected())
|
||||
return {};
|
||||
// https://www.w3.org/TR/html-aria/#el-input-button
|
||||
if (type_state() == TypeAttributeState::Button)
|
||||
return ARIA::Role::button;
|
||||
// https://www.w3.org/TR/html-aria/#el-input-checkbox
|
||||
if (type_state() == TypeAttributeState::Checkbox) {
|
||||
// https://github.com/w3c/html-aam/issues/496
|
||||
if (has_attribute("switch"_string))
|
||||
if (has_attribute(HTML::AttributeNames::switch_))
|
||||
return ARIA::Role::switch_;
|
||||
return ARIA::Role::checkbox;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user