mirror of
https://github.com/RGBCube/serenity
synced 2025-07-23 10:37:41 +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
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);
|
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)
|
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
|
// 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());
|
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.
|
// 5. If old focus target is not one of the entries in old chain, then return.
|
||||||
for (auto& node : old_chain) {
|
auto it = old_chain.find_if([&](auto const& node) { return old_focus_target == node; });
|
||||||
if (old_focus_target != node) {
|
if (it == old_chain.end())
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 6. If old focus target is not a focusable area, then return.
|
// 6. If old focus target is not a focusable area, then return.
|
||||||
if (!old_focus_target->is_focusable())
|
if (!old_focus_target->is_focusable())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue