LibWeb: Return true for is_focusable() elements with non-null tabindex

This change implements the requirements stated in the HTML spec at
https://html.spec.whatwg.org/multipage/interaction.html#tabindex-value
that UAs must allow HTML elements with non-null tabindex values to be
considered as focusable areas.
This commit is contained in:
sideshowbarker
2024-12-20 17:48:47 +09:00
committed by Sam Atkins
parent 173368bd5e
commit 56c7857053

View File

@@ -92,7 +92,7 @@ void HTMLElement::set_dir(String const& dir)
bool HTMLElement::is_focusable() const
{
return is_editing_host();
return is_editing_host() || get_attribute(HTML::AttributeNames::tabindex).has_value();
}
// https://html.spec.whatwg.org/multipage/interaction.html#dom-iscontenteditable