mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-05 15:49:11 +00:00
LibWeb: Run focusing steps on navigation with the tab key
We run these steps when focusing with a mouse pointer, and it seems sensible to implement the same behavior for keyboard navigation so we e.g. correctly unwind the previous focus chain.
This commit is contained in:
parent
7016921067
commit
66813aea79
Notes:
github-actions[bot]
2025-06-13 15:40:25 +00:00
Author: https://github.com/gmta
Commit: 66813aea79
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5074
1 changed files with 4 additions and 4 deletions
|
@ -1001,7 +1001,7 @@ EventResult EventHandler::focus_next_element()
|
|||
|
||||
for (; element; element = element->next_element_in_pre_order()) {
|
||||
if (element->is_focusable()) {
|
||||
m_navigable->active_document()->set_focused_element(element);
|
||||
HTML::run_focusing_steps(element, nullptr, HTML::FocusTrigger::Key);
|
||||
return EventResult::Handled;
|
||||
}
|
||||
}
|
||||
|
@ -1019,7 +1019,7 @@ EventResult EventHandler::focus_next_element()
|
|||
if (!element)
|
||||
return set_focus_to_first_focusable_element();
|
||||
|
||||
m_navigable->active_document()->set_focused_element(element);
|
||||
HTML::run_focusing_steps(element, nullptr, HTML::FocusTrigger::Key);
|
||||
return EventResult::Handled;
|
||||
}
|
||||
|
||||
|
@ -1036,7 +1036,7 @@ EventResult EventHandler::focus_previous_element()
|
|||
|
||||
for (; element; element = element->previous_element_in_pre_order()) {
|
||||
if (element->is_focusable()) {
|
||||
m_navigable->active_document()->set_focused_element(element);
|
||||
HTML::run_focusing_steps(element, nullptr, HTML::FocusTrigger::Key);
|
||||
return EventResult::Handled;
|
||||
}
|
||||
}
|
||||
|
@ -1054,7 +1054,7 @@ EventResult EventHandler::focus_previous_element()
|
|||
if (!element)
|
||||
return set_focus_to_last_focusable_element();
|
||||
|
||||
m_navigable->active_document()->set_focused_element(element);
|
||||
HTML::run_focusing_steps(element, nullptr, HTML::FocusTrigger::Key);
|
||||
return EventResult::Handled;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue