diff --git a/Libraries/LibWeb/HTML/Focus.cpp b/Libraries/LibWeb/HTML/Focus.cpp index 79dd1fd8c44..9c143e0d95d 100644 --- a/Libraries/LibWeb/HTML/Focus.cpp +++ b/Libraries/LibWeb/HTML/Focus.cpp @@ -216,7 +216,9 @@ void run_focusing_steps(DOM::Node* new_focus_target, DOM::Node* fallback_target, new_focus_target = content_navigable->active_document(); } - // FIXME: 4. If new focus target is a focusable area and its DOM anchor is inert, then return. + // 4. If new focus target is a focusable area and its DOM anchor is inert, then return. + if (new_focus_target->is_inert()) + return; // 5. If new focus target is the currently focused area of a top-level browsing context, then return. if (!new_focus_target->document().browsing_context()) @@ -264,7 +266,9 @@ void run_unfocusing_steps(DOM::Node* old_focus_target) } } - // FIXME: 2. If old focus target is inert, then return. + // 2. If old focus target is inert, then return. + if (old_focus_target->is_inert()) + return; // FIXME: 3. If old focus target is an area element and one of its shapes is the currently focused area of a // top-level browsing context, or, if old focus target is an element with one or more scrollable regions, and one diff --git a/Tests/LibWeb/Text/expected/wpt-import/inert/inert-node-is-unfocusable.txt b/Tests/LibWeb/Text/expected/wpt-import/inert/inert-node-is-unfocusable.txt new file mode 100644 index 00000000000..a3baba57b52 --- /dev/null +++ b/Tests/LibWeb/Text/expected/wpt-import/inert/inert-node-is-unfocusable.txt @@ -0,0 +1,11 @@ +Harness status: OK + +Found 6 tests + +6 Pass +Pass Button outside of inert container is focusable. +Pass Button with inert atribute is unfocusable. +Pass All focusable elements inside inert subtree are unfocusable +Pass Can get inert via property +Pass Elements inside of inert subtrees return false when getting 'inert' +Pass Setting inert via property correctly modifies inert state \ No newline at end of file diff --git a/Tests/LibWeb/Text/input/wpt-import/inert/inert-node-is-unfocusable.html b/Tests/LibWeb/Text/input/wpt-import/inert/inert-node-is-unfocusable.html new file mode 100644 index 00000000000..82416bc1635 --- /dev/null +++ b/Tests/LibWeb/Text/input/wpt-import/inert/inert-node-is-unfocusable.html @@ -0,0 +1,79 @@ + + +
+ +