Skip to content

Truly independent web browser

LibWeb: Implement the sequential focus navigation order

Andreas Kling5f949fa0ed35
diff --git a/Libraries/LibWeb/HTML/Focus.cpp b/Libraries/LibWeb/HTML/Focus.cpp
index 3d4ce352b4a..d806f4311d0 100644
--- a/Libraries/LibWeb/HTML/Focus.cpp
+++ b/Libraries/LibWeb/HTML/Focus.cpp
@@ -6,6 +6,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
+#include <AK/QuickSort.h>
#include <AK/TypeCasts.h>
#include <AK/Vector.h>
#include <LibGC/Root.h>
@@ -19,9 +20,11 @@
#include <LibWeb/HTML/Focus.h>
#include <LibWeb/HTML/HTMLAreaElement.h>
#include <LibWeb/HTML/HTMLInputElement.h>
+#include <LibWeb/HTML/HTMLSlotElement.h>
#include <LibWeb/HTML/LocalNavigable.h>
#include <LibWeb/HTML/NavigableContainer.h>
#include <LibWeb/HTML/Navigation.h>
+#include <LibWeb/HTML/Numbers.h>
#include <LibWeb/HTML/RemoteNavigable.h>
#include <LibWeb/HTML/Scripting/Environments.h>
#include <LibWeb/HTML/WindowProxy.h>
@@ -693,4 +696,301 @@ void run_unfocusing_steps(GC::Ptr<DOM::Node> old_focus_target)
// with the focusing steps.
}
+// https://html.spec.whatwg.org/multipage/interaction.html#focus-navigation-scope-owner
+static bool is_focus_navigation_scope_owner(DOM::Node const& node)
+{
+ // A node is a focus navigation scope owner if it is a Document, a shadow host, a slot, or an element which is the
+ // popover trigger of an element in the popover showing state.
+ // FIXME: Handle popover triggers.
+ if (is<DOM::Document>(node))
+ return true;
+ if (auto const* element = as_if<DOM::Element>(node))
+ return element->is_shadow_host() || is<HTMLSlotElement>(*element);
+ return false;
+}
+
+// NB: Appends the descendants of parent that have the same associated focus navigation owner as parent's children.
+static void append_focus_navigation_scope_descendants(DOM::Node& parent, Vector<GC::Ref<DOM::Element>>& scope)
+{
+ for (auto* child = parent.first_child(); child; child = child->next_sibling()) {
+ auto* element = as_if<DOM::Element>(*child);
+ if (!element)
+ continue;
+ scope.append(*element);
+
+ // NB: The associated focus navigation owner of a shadow host's child is its assigned slot.
+ if (element->is_shadow_host())
+ continue;
+
+ // INTEROP: A slot's fallback content belongs to the slot's own focus navigation scope; see
+ // focus_navigation_scope().
+ if (is<HTMLSlotElement>(*element))
+ continue;
+
+ append_focus_navigation_scope_descendants(*element, scope);
+ }
+}
+
+// https://html.spec.whatwg.org/multipage/interaction.html#focus-navigation-scope
+static GC::ConservativeVector<GC::Ref<DOM::Element>> focus_navigation_scope(DOM::Node& owner)
+{
+ // The contents of a given focus navigation scope owner owner's focus navigation scope are all elements whose
+ // associated focus navigation owner is owner.
+ // NB: We collect them in tree order by walking down from owner, instead of computing the associated focus
+ // navigation owner of every element.
+ GC::ConservativeVector<GC::Ref<DOM::Element>> scope;
+
+ if (auto* document = as_if<DOM::Document>(owner)) {
+ // NB: We treat the document element as being in its document's scope.
+ if (auto* document_element = document->document_element()) {
+ scope.append(*document_element);
+ append_focus_navigation_scope_descendants(*document_element, scope);
+ }
+ return scope;
+ }
+
+ if (auto* slot = as_if<HTMLSlotElement>(owner)) {
+ // INTEROP: The spec puts a slot's fallback content in the focus navigation scope of the slot's shadow host,
+ // ordered by tabindex among the other elements of the shadow tree. Browsers instead put it in the
+ // slot's own scope, so it is navigated at the position of the slot, where it is rendered. We match
+ // them. The fallback content is only rendered while the slot has no assigned nodes.
+ if (slot->assigned_nodes_internal().is_empty()) {
+ append_focus_navigation_scope_descendants(*slot, scope);
+ return scope;
+ }
+
+ for (auto const& slottable : slot->assigned_nodes_internal()) {
+ auto const* element = slottable.get_pointer<GC::Ref<DOM::Element>>();
+ if (!element)
+ continue;
+ scope.append(*element);
+ // NB: A shadow host or a slot owns the focus navigation scope of its own descendants.
+ if (!(*element)->is_shadow_host() && !is<HTMLSlotElement>(**element))
+ append_focus_navigation_scope_descendants(*element, scope);
+ }
+ return scope;
+ }
+
+ if (auto* element = as_if<DOM::Element>(owner); element && element->is_shadow_host())
+ append_focus_navigation_scope_descendants(*element->shadow_root(), scope);
+
+ return scope;
+}
+
+// NB: Whether element is a focusable area, for the purposes of sequential focus navigation.
+static bool is_sequential_focus_navigation_focusable_area(DOM::Element const& element)
+{
+ // INTEROP: A slot with a tabindex attribute is a focusable area in the spec, but browsers never focus a slot
+ // through sequential focus navigation. We match them.
+ if (is<HTMLSlotElement>(element))
+ return false;
+ return is_focusable_area(const_cast<DOM::Element&>(element));
+}
+
+// https://html.spec.whatwg.org/multipage/interaction.html#tabindex-value
+static Optional<i32> tabindex_value(DOM::Element const& element)
+{
+ auto attribute = element.attribute(AttributeNames::tabindex);
+ if (!attribute.has_value())
+ return {};
+ return parse_integer(*attribute);
+}
+
+// https://html.spec.whatwg.org/multipage/interaction.html#tabindex-ordered-focus-navigation-scope
+static GC::ConservativeVector<GC::Ref<DOM::Element>> tabindex_ordered_focus_navigation_scope(DOM::Node& owner)
+{
+ // A tabindex-ordered focus navigation scope is a list of focusable areas and focus navigation scope owners.
+ // Every focus navigation scope owner owner has tabindex-ordered focus navigation scope, whose contents are
+ // determined as follows:
+ // - It contains all elements in owner's focus navigation scope that are themselves focus navigation scope owners,
+ // except the elements whose tabindex value is a negative integer.
+ // - It contains all of the focusable areas whose DOM anchor is an element in owner's focus navigation scope,
+ // except the focusable areas whose tabindex value is a negative integer.
+ // The order within a tabindex-ordered focus navigation scope is determined by each element's tabindex value.
+ // NB: Elements with a positive tabindex value come first, in increasing order of that value and then in tree
+ // order. The elements with a tabindex value of zero or null follow in tree order.
+ struct Item {
+ GC::Ref<DOM::Element> element;
+ i32 tabindex;
+ size_t tree_index;
+ };
+ GC::ConservativeVector<Item> positive_items;
+ GC::ConservativeVector<GC::Ref<DOM::Element>> result;
+
+ for (auto const& element : focus_navigation_scope(owner)) {
+ if (!is_focus_navigation_scope_owner(*element) && !is_sequential_focus_navigation_focusable_area(*element))
+ continue;
+
+ auto tabindex = tabindex_value(*element).value_or(0);
+ if (tabindex < 0)
+ continue;
+
+ if (tabindex > 0)
+ positive_items.append({ element, tabindex, positive_items.size() });
+ else
+ result.append(element);
+ }
+
+ // NB: Elements with the same tabindex value stay in tree order.
+ quick_sort(positive_items, [](auto const& a, auto const& b) {
+ if (a.tabindex != b.tabindex)
+ return a.tabindex < b.tabindex;
+ return a.tree_index < b.tree_index;
+ });
+
+ GC::ConservativeVector<GC::Ref<DOM::Element>> ordered;
+ ordered.ensure_capacity(positive_items.size() + result.size());
+ for (auto const& item : positive_items)
+ ordered.unchecked_append(item.element);
+ ordered.extend(move(result));
+ return ordered;
+}
+
+// https://html.spec.whatwg.org/multipage/interaction.html#flattened-tabindex-ordered-focus-navigation-scope
+static void append_flattened_tabindex_ordered_focus_navigation_scope(DOM::Node& owner, Vector<GC::Ref<DOM::Element>>& result)
+{
+ // 1. Let result be a clone of owner's tabindex-ordered focus navigation scope.
+ // 2. For each item of result:
+ for (auto const& item : tabindex_ordered_focus_navigation_scope(owner)) {
+ // 1. If item is not a focus navigation scope owner, then continue.
+ if (!is_focus_navigation_scope_owner(*item)) {
+ result.append(item);
+ continue;
+ }
+
+ // 2. If item is not a focusable area, then replace item with all of the items in item's flattened
+ // tabindex-ordered focus navigation scope.
+ if (!is_sequential_focus_navigation_focusable_area(*item)) {
+ append_flattened_tabindex_ordered_focus_navigation_scope(*item, result);
+ continue;
+ }
+
+ // 3. Otherwise, insert the contents of item's flattened tabindex-ordered focus navigation scope after item.
+ result.append(item);
+ append_flattened_tabindex_ordered_focus_navigation_scope(*item, result);
+ }
+}
+
+// https://html.spec.whatwg.org/multipage/interaction.html#sequential-focus-navigation-order
+GC::ConservativeVector<GC::Ref<DOM::Element>> sequential_focus_navigation_order(DOM::Document& document)
+{
+ // Each Document has a sequential focus navigation order, which orders some or all of the focusable areas in the
+ // Document relative to each other. Its contents and ordering are given by the flattened tabindex-ordered focus
+ // navigation scope of the Document.
+ GC::ConservativeVector<GC::Ref<DOM::Element>> order;
+ append_flattened_tabindex_ordered_focus_navigation_scope(document, order);
+ return order;
+}
+
+// https://html.spec.whatwg.org/multipage/interaction.html#suitable-sequentially-focusable-area
+static bool is_suitable_sequentially_focusable_area(DOM::Element const& element)
+{
+ // A suitable sequentially focusable area is a focusable area whose DOM anchor is not inert and is sequentially
+ // focusable.
+ if (element.is_inert() || !is_sequential_focus_navigation_focusable_area(element))
+ return false;
+ return tabindex_value(element).value_or(0) >= 0;
+}
+
+// https://html.spec.whatwg.org/multipage/interaction.html#sequential-navigation-search-algorithm
+GC::Ptr<DOM::Element> sequential_navigation_search(Variant<GC::Ref<LocalNavigable>, GC::Ref<DOM::Node>> starting_point, SequentialFocusDirection direction, SelectionMechanism selection_mechanism)
+{
+ // 1. Pick the appropriate cell from the following table, and follow the instructions in that cell.
+ // The appropriate cell is the one that is from the column whose header describes direction and from the first
+ // row whose header describes starting point and selection mechanism.
+ GC::Ptr<DOM::Element> candidate;
+
+ if (auto const* navigable = starting_point.get_pointer<GC::Ref<LocalNavigable>>()) {
+ // -> starting point is a navigable
+ // forward: Let candidate be the first suitable sequentially focusable area in starting point's active
+ // document, if any; or else null.
+ // backward: Let candidate be the last suitable sequentially focusable area in starting point's active
+ // document, if any; or else null.
+ auto document = (*navigable)->active_document();
+ if (!document)
+ return nullptr;
+ auto order = sequential_focus_navigation_order(*document);
+ if (direction == SequentialFocusDirection::Forward) {
+ for (auto const& element : order) {
+ if (is_suitable_sequentially_focusable_area(*element)) {
+ candidate = element;
+ break;
+ }
+ }
+ } else {
+ for (auto const& element : order.in_reverse()) {
+ if (is_suitable_sequentially_focusable_area(*element)) {
+ candidate = element;
+ break;
+ }
+ }
+ }
+ } else {
+ auto node = starting_point.get<GC::Ref<DOM::Node>>();
+
+ if (selection_mechanism == SelectionMechanism::DOM) {
+ // -> selection mechanism is "DOM"
+ // forward: Let candidate be the suitable sequentially focusable area, that appears nearest after
+ // starting point in starting point's Document, in shadow-including tree order, if any; or
+ // else null.
+ // backward: Let candidate be the suitable sequentially focusable area, that appears nearest before
+ // starting point in starting point's Document, in shadow-including tree order, if any; or
+ // else null.
+ bool passed_starting_point = false;
+ node->document().for_each_shadow_including_inclusive_descendant([&](DOM::Node& descendant) {
+ if (&descendant == node.ptr()) {
+ passed_starting_point = true;
+ return direction == SequentialFocusDirection::Forward ? TraversalDecision::Continue : TraversalDecision::Break;
+ }
+ auto* element = as_if<DOM::Element>(descendant);
+ if (!element || !is_suitable_sequentially_focusable_area(*element))
+ return TraversalDecision::Continue;
+ if (direction == SequentialFocusDirection::Backward) {
+ candidate = element;
+ return TraversalDecision::Continue;
+ }
+ if (passed_starting_point) {
+ candidate = element;
+ return TraversalDecision::Break;
+ }
+ return TraversalDecision::Continue;
+ });
+ } else {
+ // -> selection mechanism is "sequential"
+ // forward: Let candidate be the first suitable sequentially focusable area after starting point, in
+ // starting point's Document's sequential focus navigation order, if any; or else null.
+ // backward: Let candidate be the last suitable sequentially focusable area before starting point, in
+ // starting point's Document's sequential focus navigation order, if any; or else null.
+ auto order = sequential_focus_navigation_order(node->document());
+ auto index = order.find_first_index_if([&](auto const& element) { return element.ptr() == node.ptr(); });
+ VERIFY(index.has_value());
+ if (direction == SequentialFocusDirection::Forward) {
+ for (size_t i = *index + 1; i < order.size(); ++i) {
+ if (is_suitable_sequentially_focusable_area(*order[i])) {
+ candidate = order[i];
+ break;
+ }
+ }
+ } else {
+ for (size_t i = *index; i > 0; --i) {
+ if (is_suitable_sequentially_focusable_area(*order[i - 1])) {
+ candidate = order[i - 1];
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ // FIXME: 2. If candidate is a navigable container with a non-null content navigable:
+ // 1. Let recursive candidate be the result of running the sequential navigation search algorithm with
+ // candidate's content navigable, direction, and "sequential".
+ // 2. If recursive candidate is null, then return the result of running the sequential navigation search
+ // algorithm with candidate, direction, and selection mechanism.
+ // 3. Otherwise, set candidate to recursive candidate.
+
+ // 3. Return candidate.
+ return candidate;
+}
+
}
diff --git a/Libraries/LibWeb/HTML/Focus.h b/Libraries/LibWeb/HTML/Focus.h
index 0f8478c8dcf..0b8f8d3fb7b 100644
--- a/Libraries/LibWeb/HTML/Focus.h
+++ b/Libraries/LibWeb/HTML/Focus.h
@@ -6,7 +6,9 @@
#pragma once
+#include <AK/Variant.h>
#include <AK/Vector.h>
+#include <LibGC/ConservativeVector.h>
#include <LibGC/Root.h>
#include <LibWeb/Export.h>
#include <LibWeb/Forward.h>
@@ -24,4 +26,19 @@ WEB_API void run_focus_update_steps(Vector<GC::Root<DOM::Node>> old_chain, Vecto
WEB_API void run_focusing_steps(GC::Ptr<DOM::Node> new_focus_target, GC::Ptr<DOM::Node> fallback_target = nullptr, FocusTrigger focus_trigger = FocusTrigger::Other, ScrollIntoView = ScrollIntoView::Yes);
WEB_API void run_unfocusing_steps(GC::Ptr<DOM::Node> old_focus_target);
+// https://html.spec.whatwg.org/multipage/interaction.html#sequential-focus-direction
+enum class SequentialFocusDirection : u8 {
+ Forward,
+ Backward,
+};
+
+// https://html.spec.whatwg.org/multipage/interaction.html#selection-mechanism
+enum class SelectionMechanism : u8 {
+ DOM,
+ Sequential,
+};
+
+WEB_API GC::ConservativeVector<GC::Ref<DOM::Element>> sequential_focus_navigation_order(DOM::Document&);
+WEB_API GC::Ptr<DOM::Element> sequential_navigation_search(Variant<GC::Ref<LocalNavigable>, GC::Ref<DOM::Node>> starting_point, SequentialFocusDirection, SelectionMechanism);
+
}
diff --git a/Libraries/LibWeb/Page/EventHandler.cpp b/Libraries/LibWeb/Page/EventHandler.cpp
index 62afd7d47d5..80ef004bcb8 100644
--- a/Libraries/LibWeb/Page/EventHandler.cpp
+++ b/Libraries/LibWeb/Page/EventHandler.cpp
@@ -1936,7 +1936,7 @@ EventResult EventHandler::handle_keydown(UIEvents::KeyCode key, u32 modifiers, u
if (!(modifiers & UIEvents::KeyModifier::Mod_Ctrl)) {
if (key == UIEvents::KeyCode::Key_Tab) {
- return modifiers & UIEvents::KeyModifier::Mod_Shift ? focus_previous_element() : focus_next_element();
+ return focus_sequentially(modifiers & UIEvents::KeyModifier::Mod_Shift ? HTML::SequentialFocusDirection::Backward : HTML::SequentialFocusDirection::Forward);
}
}
@@ -2926,76 +2926,73 @@ EventResult EventHandler::input_event(Utf16FlyString const& event_name, Utf16Fly
return document->root().dispatch_event(event) ? EventResult::Accepted : EventResult::Cancelled;
}
-EventResult EventHandler::focus_next_element()
+// https://html.spec.whatwg.org/multipage/interaction.html#sequential-focus-navigation
+EventResult EventHandler::focus_sequentially(HTML::SequentialFocusDirection direction)
{
- if (!m_navigable->active_document())
- return EventResult::Dropped;
- if (!m_navigable->active_document()->is_fully_active())
- return EventResult::Dropped;
-
- auto set_focus_to_first_focusable_element = [&] {
- auto* element = m_navigable->active_document()->first_child_of_type<DOM::Element>();
-
- for (; element; element = element->next_element_in_pre_order()) {
- if (element->is_focusable()) {
- HTML::run_focusing_steps(element, nullptr, HTML::FocusTrigger::Key);
- return EventResult::Handled;
- }
- }
-
+ auto document = m_navigable->active_document();
+ if (!document || !document->is_fully_active())
return EventResult::Dropped;
- };
- auto node = m_navigable->active_document()->sequential_focus_navigation_starting_point();
- if (!node)
- node = m_navigable->active_document()->focused_area();
- if (!node)
- return set_focus_to_first_focusable_element();
+ // 1. Let starting point be the currently focused area of a top-level traversable, if the user requested to move
+ // focus sequentially from there, or else the top-level traversable itself, if the user instead requested to
+ // move focus from outside the top-level traversable.
+ // NB: Without a focused element, we start from the navigable, which makes us start at the beginning (or end) of
+ // the sequential focus navigation order.
+ Variant<GC::Ref<HTML::LocalNavigable>, GC::Ref<DOM::Node>> starting_point = GC::Ref<HTML::LocalNavigable> { *m_navigable };
+ if (auto focused_area = document->focused_area(); focused_area && !is<DOM::Document>(*focused_area))
+ starting_point = GC::Ref { *focused_area };
+
+ // 2. If there is a sequential focus navigation starting point defined and it is inside starting point, then let
+ // starting point be the sequential focus navigation starting point instead.
+ if (auto sequential_starting_point = document->sequential_focus_navigation_starting_point(); sequential_starting_point && &sequential_starting_point->document() == document.ptr()) {
+ auto is_inside_starting_point = starting_point.visit(
+ [](GC::Ref<HTML::LocalNavigable>) { return true; },
+ [&](GC::Ref<DOM::Node> node) { return node->is_shadow_including_inclusive_ancestor_of(*sequential_starting_point); });
+ if (is_inside_starting_point)
+ starting_point = GC::Ref { *sequential_starting_point };
+ }
- for (node = node->next_in_pre_order(); node && !node->is_focusable(); node = node->next_in_pre_order())
- ;
+ // 3. Let direction be "forward" if the user requested the next control, and "backward" if the user requested the
+ // previous control.
+
+ // 4. Loop: Let selection mechanism be "sequential" if starting point is a navigable or if starting point is in its
+ // Document's sequential focus navigation order.
+ // Otherwise, starting point is not in its Document's sequential focus navigation order; let selection mechanism
+ // be "DOM".
+ auto selection_mechanism = starting_point.visit(
+ [](GC::Ref<HTML::LocalNavigable>) { return HTML::SelectionMechanism::Sequential; },
+ [](GC::Ref<DOM::Node> node) {
+ auto order = HTML::sequential_focus_navigation_order(node->document());
+ auto is_in_order = order.find_first_index_if([&](auto const& element) { return element.ptr() == node.ptr(); }).has_value();
+ return is_in_order ? HTML::SelectionMechanism::Sequential : HTML::SelectionMechanism::DOM;
+ });
- if (!node)
- return set_focus_to_first_focusable_element();
+ // 5. Let candidate be the result of running the sequential navigation search algorithm with starting point,
+ // direction, and selection mechanism.
+ auto candidate = HTML::sequential_navigation_search(starting_point, direction, selection_mechanism);
- HTML::run_focusing_steps(node, nullptr, HTML::FocusTrigger::Key);
- return EventResult::Handled;
-}
+ // 6. If candidate is not null, then run the focusing steps for candidate and return.
+ if (candidate) {
+ HTML::run_focusing_steps(candidate, nullptr, HTML::FocusTrigger::Key);
+ return EventResult::Handled;
+ }
-EventResult EventHandler::focus_previous_element()
-{
- if (!m_navigable->active_document())
- return EventResult::Dropped;
- if (!m_navigable->active_document()->is_fully_active())
+ // 7. Otherwise, unset the sequential focus navigation starting point.
+ document->move_sequential_focus_navigation_starting_point_to(nullptr);
+
+ // 8. If starting point is a top-level traversable, or a focusable area in the top-level traversable, the user
+ // agent should transfer focus to its own controls appropriately (if any), honouring direction, and then return.
+ // FIXME: 9. Otherwise, starting point is a focusable area in a child navigable. Set starting point to that child
+ // navigable's parent and return to the step labeled loop.
+ // NB: We do not move focus to the browser's own controls, and keep focus inside a child navigable. In both cases,
+ // we restart these steps with the navigable itself as the starting point, which the spec allows a user agent
+ // without sequentially focusable controls to do.
+ if (starting_point.has<GC::Ref<HTML::LocalNavigable>>())
return EventResult::Dropped;
-
- auto set_focus_to_last_focusable_element = [&] {
- // FIXME: This often returns the HTML element itself, which has no previous sibling.
- auto* element = m_navigable->active_document()->last_child_of_type<DOM::Element>();
-
- for (; element; element = element->previous_element_in_pre_order()) {
- if (element->is_focusable()) {
- HTML::run_focusing_steps(element, nullptr, HTML::FocusTrigger::Key);
- return EventResult::Handled;
- }
- }
-
+ candidate = HTML::sequential_navigation_search(GC::Ref<HTML::LocalNavigable> { *m_navigable }, direction, HTML::SelectionMechanism::Sequential);
+ if (!candidate)
return EventResult::Dropped;
- };
-
- auto node = m_navigable->active_document()->sequential_focus_navigation_starting_point();
- if (!node)
- node = m_navigable->active_document()->focused_area();
- if (!node)
- return set_focus_to_last_focusable_element();
-
- for (node = node->previous_in_pre_order(); node && !node->is_focusable(); node = node->previous_in_pre_order())
- ;
-
- if (!node)
- return set_focus_to_last_focusable_element();
-
- HTML::run_focusing_steps(node, nullptr, HTML::FocusTrigger::Key);
+ HTML::run_focusing_steps(candidate, nullptr, HTML::FocusTrigger::Key);
return EventResult::Handled;
}
diff --git a/Libraries/LibWeb/Page/EventHandler.h b/Libraries/LibWeb/Page/EventHandler.h
index f8d56ae801c..8f8d2661bd2 100644
--- a/Libraries/LibWeb/Page/EventHandler.h
+++ b/Libraries/LibWeb/Page/EventHandler.h
@@ -35,6 +35,12 @@
#include <LibWebCommon/PixelUnits.h>
#include <LibWebCommon/UIEvents/KeyCode.h>
+namespace Web::HTML {
+
+enum class SequentialFocusDirection : u8;
+
+}
+
namespace Web {
struct AsyncScrollOperation {
@@ -145,8 +151,7 @@ private:
[[nodiscard]] EventResult perform_cut_action();
EventResult insert_pasted_content(Utf16View plain_text, Optional<Utf16View> html);
- EventResult focus_next_element();
- EventResult focus_previous_element();
+ EventResult focus_sequentially(HTML::SequentialFocusDirection);
struct MouseEventCoordinates {
CSSPixelPoint page_offset;
diff --git a/Tests/LibWeb/Text/expected/wpt-import/html/semantics/forms/the-select-element/customizable-select/select-tabindex-order.txt b/Tests/LibWeb/Text/expected/wpt-import/html/semantics/forms/the-select-element/customizable-select/select-tabindex-order.txt
index eb6d0ba840b..e54d5125988 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/html/semantics/forms/the-select-element/customizable-select/select-tabindex-order.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/html/semantics/forms/the-select-element/customizable-select/select-tabindex-order.txt
@@ -2,5 +2,5 @@ Harness status: OK
Found 1 tests
-1 Fail
-Fail Check that tabindex applies to <select>
\ No newline at end of file
+1 Pass
+Pass Check that tabindex applies to <select>
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/html5-tree/tabindex-002.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/html5-tree/tabindex-002.txt
index 308ff6b48a8..9f95b4b3a7b 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/html5-tree/tabindex-002.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/html5-tree/tabindex-002.txt
@@ -2,5 +2,5 @@ Harness status: OK
Found 1 tests
-1 Fail
-Fail Elements with different tabindex must be focused sequentially when pressing 'Tab' keys
\ No newline at end of file
+1 Pass
+Pass Elements with different tabindex must be focused sequentially when pressing 'Tab' keys
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus-navigation/focus-navigation-slot-fallback-default-tabindex.txt b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus-navigation/focus-navigation-slot-fallback-default-tabindex.txt
index 3f221bb0fe4..69072162971 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus-navigation/focus-navigation-slot-fallback-default-tabindex.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus-navigation/focus-navigation-slot-fallback-default-tabindex.txt
@@ -2,5 +2,5 @@ Harness status: OK
Found 1 tests
-1 Fail
-Fail Default tabindex for a slot node should be 0.
\ No newline at end of file
+1 Pass
+Pass Default tabindex for a slot node should be 0.
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus-navigation/focus-navigation-slot-fallback.txt b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus-navigation/focus-navigation-slot-fallback.txt
index e0991ded71c..b6f4cf3ed10 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus-navigation/focus-navigation-slot-fallback.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus-navigation/focus-navigation-slot-fallback.txt
@@ -2,5 +2,5 @@ Harness status: OK
Found 1 tests
-1 Fail
-Fail Focus should jump to fallback elements when a slot does not have any assigned nodes.
\ No newline at end of file
+1 Pass
+Pass Focus should jump to fallback elements when a slot does not have any assigned nodes.
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus-navigation/focus-navigation-slot-nested-2levels.txt b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus-navigation/focus-navigation-slot-nested-2levels.txt
index 0d67306cfed..f774f886ff9 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus-navigation/focus-navigation-slot-nested-2levels.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus-navigation/focus-navigation-slot-nested-2levels.txt
@@ -2,5 +2,5 @@ Harness status: OK
Found 1 tests
-1 Fail
-Fail Focus controller should treat each slot as a focus scope.
\ No newline at end of file
+1 Pass
+Pass Focus controller should treat each slot as a focus scope.
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus-navigation/focus-navigation-slot-nested-delegatesFocus.txt b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus-navigation/focus-navigation-slot-nested-delegatesFocus.txt
index 0d67306cfed..f774f886ff9 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus-navigation/focus-navigation-slot-nested-delegatesFocus.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus-navigation/focus-navigation-slot-nested-delegatesFocus.txt
@@ -2,5 +2,5 @@ Harness status: OK
Found 1 tests
-1 Fail
-Fail Focus controller should treat each slot as a focus scope.
\ No newline at end of file
+1 Pass
+Pass Focus controller should treat each slot as a focus scope.
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus-navigation/focus-navigation-slot-nested-fallback.txt b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus-navigation/focus-navigation-slot-nested-fallback.txt
index 53a0ba67c13..d2b6a3bcae8 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus-navigation/focus-navigation-slot-nested-fallback.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus-navigation/focus-navigation-slot-nested-fallback.txt
@@ -2,5 +2,5 @@ Harness status: OK
Found 1 tests
-1 Fail
-Fail Focus should cover assigned elements of an assigned slot espacially there are fallback contents.
\ No newline at end of file
+1 Pass
+Pass Focus should cover assigned elements of an assigned slot espacially there are fallback contents.
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus-navigation/focus-navigation-slot-nested.txt b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus-navigation/focus-navigation-slot-nested.txt
index 0d67306cfed..f774f886ff9 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus-navigation/focus-navigation-slot-nested.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus-navigation/focus-navigation-slot-nested.txt
@@ -2,5 +2,5 @@ Harness status: OK
Found 1 tests
-1 Fail
-Fail Focus controller should treat each slot as a focus scope.
\ No newline at end of file
+1 Pass
+Pass Focus controller should treat each slot as a focus scope.
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus-navigation/focus-navigation-slot-shadow-in-fallback.txt b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus-navigation/focus-navigation-slot-shadow-in-fallback.txt
index 1443b7e4051..e0dacc8e490 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus-navigation/focus-navigation-slot-shadow-in-fallback.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus-navigation/focus-navigation-slot-shadow-in-fallback.txt
@@ -2,5 +2,5 @@ Harness status: OK
Found 1 tests
-1 Fail
-Fail Focus should cover assigned elements of an assigned slot, as well as elements that are directly assigned to a slot.
\ No newline at end of file
+1 Pass
+Pass Focus should cover assigned elements of an assigned slot, as well as elements that are directly assigned to a slot.
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus-navigation/focus-navigation-slot-shadow-in-slot.txt b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus-navigation/focus-navigation-slot-shadow-in-slot.txt
index 1443b7e4051..e0dacc8e490 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus-navigation/focus-navigation-slot-shadow-in-slot.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus-navigation/focus-navigation-slot-shadow-in-slot.txt
@@ -2,5 +2,5 @@ Harness status: OK
Found 1 tests
-1 Fail
-Fail Focus should cover assigned elements of an assigned slot, as well as elements that are directly assigned to a slot.
\ No newline at end of file
+1 Pass
+Pass Focus should cover assigned elements of an assigned slot, as well as elements that are directly assigned to a slot.
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus-navigation/focus-navigation-slot-with-tabindex.txt b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus-navigation/focus-navigation-slot-with-tabindex.txt
index d573850fd0d..e55307c90c5 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus-navigation/focus-navigation-slot-with-tabindex.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus-navigation/focus-navigation-slot-with-tabindex.txt
@@ -2,5 +2,5 @@ Harness status: OK
Found 1 tests
-1 Fail
-Fail Slots tabindex should be considred in focus navigation.
\ No newline at end of file
+1 Pass
+Pass Slots tabindex should be considred in focus navigation.
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus-navigation/focus-navigation-slots.txt b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus-navigation/focus-navigation-slots.txt
index 1443b7e4051..e0dacc8e490 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus-navigation/focus-navigation-slots.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus-navigation/focus-navigation-slots.txt
@@ -2,5 +2,5 @@ Harness status: OK
Found 1 tests
-1 Fail
-Fail Focus should cover assigned elements of an assigned slot, as well as elements that are directly assigned to a slot.
\ No newline at end of file
+1 Pass
+Pass Focus should cover assigned elements of an assigned slot, as well as elements that are directly assigned to a slot.
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus-navigation/focus-navigation-web-component-radio.txt b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus-navigation/focus-navigation-web-component-radio.txt
index 951bacaa9b7..02dc576b512 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus-navigation/focus-navigation-web-component-radio.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus-navigation/focus-navigation-web-component-radio.txt
@@ -2,5 +2,5 @@ Harness status: OK
Found 1 tests
-1 Fail
-Fail Focus for web component input type elements should be bound by <form> inside shadow DOM
\ No newline at end of file
+1 Pass
+Pass Focus for web component input type elements should be bound by <form> inside shadow DOM
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus-navigation/focus-navigation.txt b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus-navigation/focus-navigation.txt
index bcdfdcb8701..cd20d6bcd97 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus-navigation/focus-navigation.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus-navigation/focus-navigation.txt
@@ -2,5 +2,5 @@ Harness status: OK
Found 1 tests
-1 Fail
-Fail Focus controller should treat slots as a focus scope.
\ No newline at end of file
+1 Pass
+Pass Focus controller should treat slots as a focus scope.
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus-navigation/focus-negative-tabindex-at-end-of-shadow-tree.txt b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus-navigation/focus-negative-tabindex-at-end-of-shadow-tree.txt
index 62f9fd56434..6bcd0e5d191 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus-navigation/focus-negative-tabindex-at-end-of-shadow-tree.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus-navigation/focus-negative-tabindex-at-end-of-shadow-tree.txt
@@ -2,6 +2,6 @@ Harness status: OK
Found 2 tests
-2 Fail
-Fail Tab moves focus past the shadow host, not back to the start of the shadow tree
-Fail Shift+Tab moves focus before the shadow host, not back to the end of the shadow tree
\ No newline at end of file
+2 Pass
+Pass Tab moves focus past the shadow host, not back to the start of the shadow tree
+Pass Shift+Tab moves focus before the shadow host, not back to the end of the shadow tree
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus-navigation/focus-reverse-unassigned-slot.txt b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus-navigation/focus-reverse-unassigned-slot.txt
index 5dc4542cf41..734baf8532c 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus-navigation/focus-reverse-unassigned-slot.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus-navigation/focus-reverse-unassigned-slot.txt
@@ -2,5 +2,5 @@ Harness status: OK
Found 1 tests
-1 Fail
-Fail Verifies that focusing backwards from a button inside a slot which has no assigned nodes goes to the previous focusable element.
\ No newline at end of file
+1 Pass
+Pass Verifies that focusing backwards from a button inside a slot which has no assigned nodes goes to the previous focusable element.
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-tabindex-order-shadow-negative-delegatesFocus.txt b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-tabindex-order-shadow-negative-delegatesFocus.txt
index 47800a7e661..9d824bcc924 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-tabindex-order-shadow-negative-delegatesFocus.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-tabindex-order-shadow-negative-delegatesFocus.txt
@@ -2,5 +2,5 @@ Harness status: OK
Found 1 tests
-1 Fail
-Fail Order when all tabindex=-1 is and delegatesFocus = true
\ No newline at end of file
+1 Pass
+Pass Order when all tabindex=-1 is and delegatesFocus = true
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-tabindex-order-shadow-negative.txt b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-tabindex-order-shadow-negative.txt
index ef0c4f9dccd..f28d34e3ae9 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-tabindex-order-shadow-negative.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-tabindex-order-shadow-negative.txt
@@ -2,5 +2,5 @@ Harness status: OK
Found 1 tests
-1 Fail
-Fail Order when all elements in shadow tree has negative tabindex
\ No newline at end of file
+1 Pass
+Pass Order when all elements in shadow tree has negative tabindex
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-tabindex-order-shadow-slot-one.txt b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-tabindex-order-shadow-slot-one.txt
index 190a5405f0d..b95fadc5ee6 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-tabindex-order-shadow-slot-one.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-tabindex-order-shadow-slot-one.txt
@@ -2,5 +2,5 @@ Harness status: OK
Found 1 tests
-1 Fail
-Fail Order when all tabindex=0, except for one slot that has tabindex=1
\ No newline at end of file
+1 Pass
+Pass Order when all tabindex=0, except for one slot that has tabindex=1
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-tabindex-order-shadow-varying-delegatesFocus.txt b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-tabindex-order-shadow-varying-delegatesFocus.txt
index 5bccccf9636..4152447dbde 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-tabindex-order-shadow-varying-delegatesFocus.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-tabindex-order-shadow-varying-delegatesFocus.txt
@@ -2,5 +2,5 @@ Harness status: OK
Found 1 tests
-1 Fail
-Fail Order when tabindex varies and delegatesFocus = true
\ No newline at end of file
+1 Pass
+Pass Order when tabindex varies and delegatesFocus = true
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-tabindex-order-shadow-varying-tabindex-2.txt b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-tabindex-order-shadow-varying-tabindex-2.txt
index 831037d28c5..d14b216e9db 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-tabindex-order-shadow-varying-tabindex-2.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-tabindex-order-shadow-varying-tabindex-2.txt
@@ -2,5 +2,5 @@ Harness status: OK
Found 1 tests
-1 Fail
-Fail Order with different tabindex on host
\ No newline at end of file
+1 Pass
+Pass Order with different tabindex on host
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-tabindex-order-shadow-varying-tabindex-3.txt b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-tabindex-order-shadow-varying-tabindex-3.txt
index 831037d28c5..d14b216e9db 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-tabindex-order-shadow-varying-tabindex-3.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-tabindex-order-shadow-varying-tabindex-3.txt
@@ -2,5 +2,5 @@ Harness status: OK
Found 1 tests
-1 Fail
-Fail Order with different tabindex on host
\ No newline at end of file
+1 Pass
+Pass Order with different tabindex on host
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-tabindex-order-shadow-varying-tabindex.txt b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-tabindex-order-shadow-varying-tabindex.txt
index 2b50cfae68a..cacbfff0173 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-tabindex-order-shadow-varying-tabindex.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-tabindex-order-shadow-varying-tabindex.txt
@@ -2,5 +2,5 @@ Harness status: OK
Found 1 tests
-1 Fail
-Fail Order with various tabindex values
\ No newline at end of file
+1 Pass
+Pass Order with various tabindex values
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-tabindex-order-shadow-zero-delegatesFocus.txt b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-tabindex-order-shadow-zero-delegatesFocus.txt
index c4f505fb8ff..34181241ff9 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-tabindex-order-shadow-zero-delegatesFocus.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-tabindex-order-shadow-zero-delegatesFocus.txt
@@ -2,5 +2,5 @@ Harness status: OK
Found 1 tests
-1 Fail
-Fail Order when all tabindex=0 is and delegatesFocus = true
\ No newline at end of file
+1 Pass
+Pass Order when all tabindex=0 is and delegatesFocus = true
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-tabindex-order-shadow-zero-host-negative.txt b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-tabindex-order-shadow-zero-host-negative.txt
index b071d0d9dac..378473bde2b 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-tabindex-order-shadow-zero-host-negative.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-tabindex-order-shadow-zero-host-negative.txt
@@ -2,5 +2,5 @@ Harness status: OK
Found 1 tests
-1 Fail
-Fail Order when all tabindex=0 except for host, which has tabindex=-1
\ No newline at end of file
+1 Pass
+Pass Order when all tabindex=0 except for host, which has tabindex=-1
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-tabindex-order-shadow-zero-host-not-set-scrollable.txt b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-tabindex-order-shadow-zero-host-not-set-scrollable.txt
index c0ec3b6a38f..45c6ddfd440 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-tabindex-order-shadow-zero-host-not-set-scrollable.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-tabindex-order-shadow-zero-host-not-set-scrollable.txt
@@ -2,5 +2,5 @@ Harness status: OK
Found 1 tests
-1 Fail
-Fail Order when all tabindex=0 except scrollable host (tabindex not set)
\ No newline at end of file
+1 Pass
+Pass Order when all tabindex=0 except scrollable host (tabindex not set)
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-tabindex-order-shadow-zero-host-not-set.txt b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-tabindex-order-shadow-zero-host-not-set.txt
index 0ab2d445d6c..3eba4d352d6 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-tabindex-order-shadow-zero-host-not-set.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-tabindex-order-shadow-zero-host-not-set.txt
@@ -2,5 +2,5 @@ Harness status: OK
Found 1 tests
-1 Fail
-Fail Order when all tabindex=0 except host (tabindex not set)
\ No newline at end of file
+1 Pass
+Pass Order when all tabindex=0 except host (tabindex not set)
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-tabindex-order-shadow-zero-host-one.txt b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-tabindex-order-shadow-zero-host-one.txt
index f36f213d1f6..8a71bb3383a 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-tabindex-order-shadow-zero-host-one.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-tabindex-order-shadow-zero-host-one.txt
@@ -2,5 +2,5 @@ Harness status: OK
Found 1 tests
-1 Fail
-Fail Order when all tabindex=0 except for host, which has tabindex=1
\ No newline at end of file
+1 Pass
+Pass Order when all tabindex=0 except for host, which has tabindex=1
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-tabindex-order-shadow-zero-host-scrollable.txt b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-tabindex-order-shadow-zero-host-scrollable.txt
index 87f39c4ffe6..b46fc27c563 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-tabindex-order-shadow-zero-host-scrollable.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-tabindex-order-shadow-zero-host-scrollable.txt
@@ -2,5 +2,5 @@ Harness status: OK
Found 1 tests
-1 Fail
-Fail Order when all tabindex=0 and host is scrollable
\ No newline at end of file
+1 Pass
+Pass Order when all tabindex=0 and host is scrollable
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-tabindex-order-shadow-zero.txt b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-tabindex-order-shadow-zero.txt
index 6c8fb1c2f46..247df99e25e 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-tabindex-order-shadow-zero.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-tabindex-order-shadow-zero.txt
@@ -2,5 +2,5 @@ Harness status: OK
Found 1 tests
-1 Fail
-Fail Order when all tabindex=0 is and delegatesFocus = false
\ No newline at end of file
+1 Pass
+Pass Order when all tabindex=0 is and delegatesFocus = false
\ No newline at end of file