LibWeb: Fire change events on deletion in FormAssociated Text Elements

Previously we would only trigger change events on insertion, which
resulted in javascript code missing changes due to deletion.

This makes the calculator on the MDN simple web worker demo update on
deletion as well.
This commit is contained in:
Idan Horowitz 2025-08-30 19:55:52 +03:00 committed by Andreas Kling
parent 87c7fb1d63
commit 849ade88ce
2 changed files with 4 additions and 0 deletions

View File

@ -62,6 +62,7 @@ enum class ShouldComputeRole {
X(DidLoseFocus) \
X(DidReceiveFocus) \
X(EditingInsertion) \
X(EditingDeletion) \
X(ElementAttributeChange) \
X(ElementSetShadowRoot) \
X(HTMLDialogElementSetIsModal) \

View File

@ -880,6 +880,9 @@ void FormAssociatedTextControlElement::handle_delete(DeleteDirection direction)
}
MUST(set_range_text({}, selection_start, selection_end, Bindings::SelectionMode::End));
text_node->invalidate_style(DOM::StyleInvalidationReason::EditingDeletion);
did_edit_text_node();
}
EventResult FormAssociatedTextControlElement::handle_return_key(FlyString const&)