LibWeb: Keep cursor in view for text controls

When editing or changing the selection inside an <input> or <textarea>,
we should scroll the container so the cursor is always visible. Note
that currently the cursor might still become invisible at the end of the
container since we do not reserve enough space for it to be made
visible.
This commit is contained in:
Jelle Raaijmakers
2026-02-06 15:03:38 +01:00
committed by Jelle Raaijmakers
parent 9d09b3ce34
commit 2d4728d353
Notes: github-actions[bot] 2026-02-11 10:18:42 +00:00
8 changed files with 73 additions and 7 deletions

View File

@@ -236,6 +236,7 @@ public:
// ^FormAssociatedTextControlElement
virtual void did_edit_text_node(FlyString const& input_type, Optional<Utf16String> const& data) override;
virtual GC::Ptr<DOM::Text> form_associated_element_to_text_node() override { return m_text_node; }
virtual GC::Ptr<DOM::Element> text_control_scroll_container() override { return m_inner_text_element; }
// https://html.spec.whatwg.org/multipage/input.html#has-a-periodic-domain/
bool has_periodic_domain() const { return type_state() == HTMLInputElement::TypeAttributeState::Time; }