LibWeb/HTML: Implement focus restoration in HTMLDialogElement

When a dialog is closed, restore focus to the previously focused
element if focus is within the dialog or if the dialog was modal.
This commit is contained in:
Feng Yu 2025-09-11 11:17:37 -07:00 committed by Jelle Raaijmakers
commit fd3c69227f
Notes: github-actions[bot] 2025-10-03 06:56:57 +00:00
4 changed files with 117 additions and 7 deletions

View file

@ -72,6 +72,9 @@ private:
// https://html.spec.whatwg.org/multipage/interactive-elements.html#dialog-toggle-task-tracker
Optional<ToggleTaskTracker> m_dialog_toggle_task_tracker;
// https://html.spec.whatwg.org/multipage/interactive-elements.html#previously-focused-element
GC::Ptr<Node> m_previously_focused_element;
};
}