mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02: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:
committed by
Andreas Kling
parent
97665fa92f
commit
7edfeb7056
Notes:
sideshowbarker
2024-07-17 09:41:18 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/7edfeb7056 Pull-request: https://github.com/SerenityOS/serenity/pull/22111
@@ -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 };
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user