mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-28 23:39:02 +00:00
LibWeb: Don't move focus when setting input value
This commit is contained in:
parent
d29797f118
commit
1d9c404b8c
Notes:
github-actions[bot]
2024-09-12 09:46:32 +00:00
Author: https://github.com/Gingeh
Commit: 1d9c404b8c
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1355
Reviewed-by: https://github.com/gmta ✅
Reviewed-by: https://github.com/trflynn89
7 changed files with 59 additions and 26 deletions
|
@ -562,7 +562,7 @@ WebIDL::ExceptionOr<void> HTMLInputElement::set_value(String const& value)
|
|||
m_text_node->set_data(m_value);
|
||||
update_placeholder_visibility();
|
||||
|
||||
document().set_cursor_position(DOM::Position::create(realm, *m_text_node, m_text_node->data().bytes().size()));
|
||||
set_the_selection_range(m_text_node->length(), m_text_node->length());
|
||||
}
|
||||
|
||||
update_shadow_tree();
|
||||
|
@ -2429,7 +2429,7 @@ HTMLInputElement::ValueAttributeMode HTMLInputElement::value_attribute_mode() co
|
|||
|
||||
void HTMLInputElement::selection_was_changed(size_t selection_start, size_t selection_end)
|
||||
{
|
||||
if (!m_text_node)
|
||||
if (!m_text_node || !document().cursor_position() || document().cursor_position()->node() != m_text_node)
|
||||
return;
|
||||
|
||||
document().set_cursor_position(DOM::Position::create(realm(), *m_text_node, selection_end));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue