LibWeb: Fire textarea input events immediately instead of debouncing

The 100ms debounce timer on textarea input events causes character
loss when JavaScript restores a previously captured value via
requestAnimationFrame. The text node mutation happens immediately
during input processing, but the input DOM event is delayed,
creating a window where stale rAF callbacks overwrite new input.

Remove the debounce timer and fire the input event immediately
via queue_an_element_task, matching HTMLInputElement behavior.
The spec notes this delay is optional ("User agents may wait").

Fixes #7793.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Dylan Hart
2026-03-27 03:34:39 -05:00
committed by Tim Flynn
parent 36c549eba7
commit c710ff5afa
Notes: github-actions[bot] 2026-03-30 17:18:58 +00:00
2 changed files with 17 additions and 30 deletions

View File

@@ -164,8 +164,6 @@ private:
void handle_maxlength_attribute();
void queue_firing_input_event();
void update_placeholder_visibility();
GC::Ptr<DOM::Element> m_placeholder_element;
@@ -174,10 +172,6 @@ private:
GC::Ptr<DOM::Element> m_inner_text_element;
GC::Ptr<DOM::Text> m_text_node;
RefPtr<Core::Timer> m_input_event_timer;
FlyString m_pending_input_event_type;
Optional<Utf16String> m_pending_input_event_data;
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#concept-fe-dirty
bool m_dirty_value { false };