mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 11:24:58 +00:00
LibWeb: Add Support for the ARIA Element Properties
Element now supports getting and setting ARIA properties from JS and HTML.
This commit is contained in:
parent
0a244b9c1f
commit
e63d9d4925
57 changed files with 976 additions and 1 deletions
|
@ -866,4 +866,66 @@ WebIDL::ExceptionOr<void> HTMLInputElement::set_selection_range(u32 start, u32 e
|
|||
return {};
|
||||
}
|
||||
|
||||
FlyString HTMLInputElement::default_role() const
|
||||
{
|
||||
// https://www.w3.org/TR/html-aria/#el-input-button
|
||||
if (type_state() == TypeAttributeState::Button)
|
||||
return DOM::ARIARoleNames::button;
|
||||
// https://www.w3.org/TR/html-aria/#el-input-checkbox
|
||||
if (type_state() == TypeAttributeState::Checkbox)
|
||||
return DOM::ARIARoleNames::checkbox;
|
||||
// https://www.w3.org/TR/html-aria/#el-input-email
|
||||
if (type_state() == TypeAttributeState::Email && attribute("list").is_null())
|
||||
return DOM::ARIARoleNames::textbox;
|
||||
// https://www.w3.org/TR/html-aria/#el-input-image
|
||||
if (type_state() == TypeAttributeState::ImageButton)
|
||||
return DOM::ARIARoleNames::button;
|
||||
// https://www.w3.org/TR/html-aria/#el-input-number
|
||||
if (type_state() == TypeAttributeState::Number)
|
||||
return DOM::ARIARoleNames::spinbutton;
|
||||
// https://www.w3.org/TR/html-aria/#el-input-radio
|
||||
if (type_state() == TypeAttributeState::RadioButton)
|
||||
return DOM::ARIARoleNames::radio;
|
||||
// https://www.w3.org/TR/html-aria/#el-input-range
|
||||
if (type_state() == TypeAttributeState::Range)
|
||||
return DOM::ARIARoleNames::slider;
|
||||
// https://www.w3.org/TR/html-aria/#el-input-reset
|
||||
if (type_state() == TypeAttributeState::ResetButton)
|
||||
return DOM::ARIARoleNames::button;
|
||||
// https://www.w3.org/TR/html-aria/#el-input-text-list
|
||||
if ((type_state() == TypeAttributeState::Text
|
||||
|| type_state() == TypeAttributeState::Search
|
||||
|| type_state() == TypeAttributeState::Telephone
|
||||
|| type_state() == TypeAttributeState::URL
|
||||
|| type_state() == TypeAttributeState::Email)
|
||||
&& !attribute("list").is_null())
|
||||
return DOM::ARIARoleNames::combobox;
|
||||
// https://www.w3.org/TR/html-aria/#el-input-search
|
||||
if (type_state() == TypeAttributeState::Search && attribute("list").is_null())
|
||||
return DOM::ARIARoleNames::textbox;
|
||||
// https://www.w3.org/TR/html-aria/#el-input-submit
|
||||
if (type_state() == TypeAttributeState::SubmitButton)
|
||||
return DOM::ARIARoleNames::button;
|
||||
// https://www.w3.org/TR/html-aria/#el-input-tel
|
||||
if (type_state() == TypeAttributeState::Telephone)
|
||||
return DOM::ARIARoleNames::textbox;
|
||||
// https://www.w3.org/TR/html-aria/#el-input-text
|
||||
if (type_state() == TypeAttributeState::Text && attribute("list").is_null())
|
||||
return DOM::ARIARoleNames::textbox;
|
||||
// https://www.w3.org/TR/html-aria/#el-input-url
|
||||
if (type_state() == TypeAttributeState::URL && attribute("list").is_null())
|
||||
return DOM::ARIARoleNames::textbox;
|
||||
|
||||
// https://www.w3.org/TR/html-aria/#el-input-color
|
||||
// https://www.w3.org/TR/html-aria/#el-input-date
|
||||
// https://www.w3.org/TR/html-aria/#el-input-datetime-local
|
||||
// https://www.w3.org/TR/html-aria/#el-input-file
|
||||
// https://www.w3.org/TR/html-aria/#el-input-hidden
|
||||
// https://www.w3.org/TR/html-aria/#el-input-month
|
||||
// https://www.w3.org/TR/html-aria/#el-input-password
|
||||
// https://www.w3.org/TR/html-aria/#el-input-time
|
||||
// https://www.w3.org/TR/html-aria/#el-input-week
|
||||
return {};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue