From 56c78570534a19b58dd67e90b57eed87ac545d7a Mon Sep 17 00:00:00 2001 From: sideshowbarker Date: Fri, 20 Dec 2024 17:48:47 +0900 Subject: [PATCH] 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. --- Libraries/LibWeb/HTML/HTMLElement.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Libraries/LibWeb/HTML/HTMLElement.cpp b/Libraries/LibWeb/HTML/HTMLElement.cpp index 476d0b1613..ea8ab713ff 100644 --- a/Libraries/LibWeb/HTML/HTMLElement.cpp +++ b/Libraries/LibWeb/HTML/HTMLElement.cpp @@ -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