mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-02-22 23:55:12 +00:00
LibWeb: Make HTMLInputElement move cursor into text node when focused
This mechanism feels rather awkward, but it's better than nothing.
This commit is contained in:
@@ -112,6 +112,21 @@ void HTMLInputElement::create_shadow_tree_if_needed()
|
||||
set_shadow_root(move(shadow_root));
|
||||
}
|
||||
|
||||
void HTMLInputElement::did_receive_focus()
|
||||
{
|
||||
auto* browsing_context = document().browsing_context();
|
||||
if (!browsing_context)
|
||||
return;
|
||||
if (!m_text_node)
|
||||
return;
|
||||
browsing_context->set_cursor_position(DOM::Position { *m_text_node, 0 });
|
||||
}
|
||||
|
||||
bool HTMLInputElement::is_focusable() const
|
||||
{
|
||||
return m_text_node;
|
||||
}
|
||||
|
||||
void HTMLInputElement::inserted()
|
||||
{
|
||||
HTMLElement::inserted();
|
||||
|
||||
Reference in New Issue
Block a user