mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 06:48:12 +00:00
LibWeb: Allow focusing individual (focusable) elements with Tab key
You can now cycle through focusable elements (currently only hyperlinks are focusable) with the Tab key. The focus outline is rendered in a new FocusOutline paint phase.
This commit is contained in:
parent
5939af14d4
commit
01022eb5d6
11 changed files with 92 additions and 2 deletions
|
@ -508,4 +508,18 @@ bool Document::is_editable() const
|
|||
return m_editable;
|
||||
}
|
||||
|
||||
void Document::set_focused_element(Element* element)
|
||||
{
|
||||
if (m_focused_element == element)
|
||||
return;
|
||||
|
||||
if (element)
|
||||
m_focused_element = element->make_weak_ptr();
|
||||
else
|
||||
m_focused_element = nullptr;
|
||||
|
||||
if (m_layout_root)
|
||||
m_layout_root->set_needs_display();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue