mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
LibWeb: Check all entries in the focus chain when unfocusing a node
The way this step was currently implemented, we would bail the unfocus steps if the node isn't the first entry in the chain.
This commit is contained in:
parent
08ee48606d
commit
3c0c300039
Notes:
sideshowbarker
2024-07-16 17:12:03 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/3c0c300039 Pull-request: https://github.com/SerenityOS/serenity/pull/22150 Reviewed-by: https://github.com/awesomekling ✅
1 changed files with 4 additions and 5 deletions
|
@ -212,6 +212,7 @@ void run_focusing_steps(DOM::Node* new_focus_target, DOM::Node* fallback_target,
|
|||
run_focus_update_steps(old_chain, new_chain, new_focus_target);
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/interaction.html#unfocusing-steps
|
||||
void run_unfocusing_steps(DOM::Node* old_focus_target)
|
||||
{
|
||||
// NOTE: The unfocusing steps do not always result in the focus changing, even when applied to the currently focused
|
||||
|
@ -254,11 +255,9 @@ void run_unfocusing_steps(DOM::Node* old_focus_target)
|
|||
auto old_chain = focus_chain(top_level_browsing_context->currently_focused_area());
|
||||
|
||||
// 5. If old focus target is not one of the entries in old chain, then return.
|
||||
for (auto& node : old_chain) {
|
||||
if (old_focus_target != node) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
auto it = old_chain.find_if([&](auto const& node) { return old_focus_target == node; });
|
||||
if (it == old_chain.end())
|
||||
return;
|
||||
|
||||
// 6. If old focus target is not a focusable area, then return.
|
||||
if (!old_focus_target->is_focusable())
|
||||
|
|
Loading…
Reference in a new issue