mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
LibWeb: Fix input@type=button|submit|reset accessible-name computation
This change makes Ladybird conform to the requirements in the HTML-AAM spec at https://w3c.github.io/html-aam/#accname-computation for the cases of HTML input@type=button, input@type=submit, and input@type=reset elements. Otherwise, without this change, Ladybird fails to expose the expected accessible names for those cases.
This commit is contained in:
committed by
Jelle Raaijmakers
parent
12b7304876
commit
7a6813cdea
@@ -2403,6 +2403,13 @@ ErrorOr<String> Node::name_or_description(NameOrDescription target, Document con
|
||||
}
|
||||
if (is<HTML::HTMLInputElement>(*element)) {
|
||||
auto& input = (const_cast<HTML::HTMLInputElement&>(static_cast<HTML::HTMLInputElement const&>(*element)));
|
||||
// https://w3c.github.io/html-aam/#input-type-button-input-type-submit-and-input-type-reset-accessible-name-computation
|
||||
// Otherwise use the value attribute.
|
||||
if (input.type_state() == HTML::HTMLInputElement::TypeAttributeState::Button
|
||||
|| input.type_state() == HTML::HTMLInputElement::TypeAttributeState::SubmitButton
|
||||
|| input.type_state() == HTML::HTMLInputElement::TypeAttributeState::ResetButton)
|
||||
if (auto value = input.get_attribute(HTML::AttributeNames::value); value.has_value())
|
||||
return value.release_value();
|
||||
// https://w3c.github.io/html-aam/#input-type-image-accessible-name-computation
|
||||
// Otherwise use alt attribute if present and its value is not the empty string.
|
||||
if (input.type_state() == HTML::HTMLInputElement::TypeAttributeState::ImageButton)
|
||||
|
||||
Reference in New Issue
Block a user