1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 07:44:59 +00:00

LibWeb: Support committing changes to <input> elements

We currently fire the change event on <input> elements when they lose
focus. The spec allows for us to also fire the event when changes are
"committed", so long as such an action makes sense for the input type.

This patch detects when the return key is entered in an <input> element
and uses that as the commit action for text-related types. If no change
has occurred since the last commit, no change event is fired.
This commit is contained in:
Timothy Flynn 2023-11-30 12:54:30 -05:00 committed by Andreas Kling
parent 97665fa92f
commit 7edfeb7056
8 changed files with 88 additions and 11 deletions

View file

@ -69,6 +69,8 @@ public:
virtual String value() const override;
WebIDL::ExceptionOr<void> set_value(String const&);
void commit_pending_changes();
Optional<DeprecatedString> placeholder_value() const;
bool checked() const { return m_checked; }
@ -215,6 +217,8 @@ private:
TypeAttributeState m_type { TypeAttributeState::Text };
String m_value;
bool m_has_uncommitted_changes { false };
};
}