-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Specify the textInput event #362
Conversation
I think fixing #361 first would be nice so that this event can slot in between |
I've moved the spec for this into event-algo.bs, since trying to make it well-defined in the current spec was ... challenging. I think this is ready for review. |
And I've not tested when replacing typo word with the spellchecker. |
WPt is required at least for:
|
Oh? There is no |
Hmm, in |
When I replace a misspell word on Chrome, Chrome does not fire |
I wonder, whether |
If I call And also a call of |
I wonder, how about |
Interestingly, Chrome and Safari seem to prevent moving focus while handling (Opening a popup works, but still fires the |
I didn't know it was a thing, but I see it in https://w3c.github.io/input-events/ (issue: w3c/input-events#20 ). Per https://www.howtogeek.com/293850/how-to-use-macos-built-in-kill-and-yank-as-an-alternative-cut-and-paste/ on macOS you can use ctrl+k to kill (cut) and ctrl+y to yank (paste). Testing in http://software.hixie.ch/utilities/js/live-dom-viewer/saved/12340 , neither Safari or Chrome fire |
Should I check if the event target is an |
Yeah, I think so. (Thank you for investigating about yanking!) |
Thanks, tested in web-platform-tests/wpt#44472 I used a smiley for non-BMP character, but I think it's not automatable with WebDriver currently. |
Done in 7b9b6a5 |
https://bugs.webkit.org/show_bug.cgi?id=268988 Reviewed by Wenson Hsieh and Ryosuke Niwa. This change makes WebKit fire the beforeinput & textInput events in the order (beforeinput first, textInput after) conforming to UI Events spec requirements at w3c/uievents#362 and in the spec at https://w3c.github.io/uievents/event-algo.html#fire%20key%20input%20events and consistent with the order in which the events are fired in Blink. Otherwise, without this change, WebKit fires the events in an order (textInput first, beforeinput after) that breaks conformance with the spec requirements, and that breaks compatibility with Blink. Note also that this change makes WebKit conform to the requirements in https://w3c.github.io/uievents/event-algo.html#fire%20key%20input%20events, https://w3c.github.io/uievents/event-algo.html#handle%20native%20paste, and https://w3c.github.io/uievents/event-algo.html#end%20composition — limiting textInput to being fired only when ending a composition or when the input type is insertText, insertParagraph, insertLineBreak, or insertFromPaste. * LayoutTests/editing/execCommand/break-out-of-empty-list-item.html: * LayoutTests/editing/inserting/typing-space-to-trigger-smart-link.html: * LayoutTests/editing/pasteboard/paste-text-events-expected.txt: * LayoutTests/editing/pasteboard/paste-text-events.html: * LayoutTests/editing/style/highlight-insert-paragraph.html: * LayoutTests/fast/events/input-events-fired-when-typing-expected.txt: * LayoutTests/fast/events/input-events-fired-when-typing.html: * LayoutTests/fast/events/ios/submit-form-target-blank-using-return-key.html: * LayoutTests/fast/events/onchange-passwordfield.html: * LayoutTests/fast/events/onchange-searchfield.html: * LayoutTests/fast/events/onchange-textfield.html: * LayoutTests/fast/forms/onchange-change-type.html: * LayoutTests/http/tests/navigation/keyboard-events-during-provisional-navigation-expected.txt: * LayoutTests/http/tests/navigation/keyboard-events-during-provisional-subframe-navigation-expected.txt: * LayoutTests/platform/mac-wk2/http/tests/navigation/keyboard-events-during-provisional-navigation-expected.txt: * LayoutTests/platform/wpe/TestExpectations: * Source/WebCore/dom/Node.cpp: (WebCore::Node::defaultEventHandler): * Source/WebCore/dom/TextEvent.cpp: (WebCore::TextEvent::TextEvent): (WebCore::TextEvent::initTextEvent): (WebCore::TextEvent::createForPlainTextPaste): Deleted. (WebCore::TextEvent::createForFragmentPaste): Deleted. (WebCore::TextEvent::createForDictation): Deleted. * Source/WebCore/dom/TextEvent.h: * Source/WebCore/editing/AlternativeTextController.cpp: (WebCore::AlternativeTextController::insertDictatedText): * Source/WebCore/editing/Editor.cpp: (WebCore::dispatchTextInputEvent): (WebCore::Editor::selectionForCommand): (WebCore::Editor::pasteAsPlainText): (WebCore::Editor::pasteAsFragment): (WebCore::dispatchTextInputEvents): (WebCore::Editor::appliedEditing): (WebCore::Editor::insertText): (WebCore::Editor::insertTextForConfirmedComposition): (WebCore::Editor::insertTextWithoutSendingTextEvent): (WebCore::Editor::setComposition): (WebCore::Editor::handleTextEvent): Deleted. * Source/WebCore/editing/Editor.h: * Source/WebCore/editing/EditorCommand.cpp: (WebCore::executeInsertBacktab): (WebCore::executeInsertLineBreak): (WebCore::executeInsertNewline): (WebCore::executeInsertTab): (WebCore::executeYank): (WebCore::executeYankAndSelect): (WebCore::enabledVisibleSelection): (WebCore::enabledVisibleSelectionAndMark): (WebCore::enableCaretInEditableText): (WebCore::enabledInEditableText): * Source/WebCore/page/EventHandler.cpp: (WebCore::EventHandler::handleTextInput): (WebCore::EventHandler::handleTextInputEvent): Deleted. (WebCore::EventHandler::defaultTextInputEventHandler): Deleted. * Source/WebCore/page/EventHandler.h: Canonical link: https://commits.webkit.org/278971@main
https://bugs.webkit.org/show_bug.cgi?id=268988 Reviewed by NOBODY (OOPS!). This change (controlled by the ConformantBeforeinputEventFiringOrderEnabled, preference, also introduced in this change) makes WebKit fire the beforeinput and textInput events in the order: beforeinput first, textInput after — conforming to the requirements at w3c/uievents#362 and https://w3c.github.io/uievents/event-algo.html#fire%20key%20input%20events and consistent with the order in which the events are fired in Blink. Otherwise, without this change, WebKit fires the events in the order: textInput first, beforeinput after — which breaks conformance with the spec requirements, and breaks compatibility with Blink. Note also that this change makes WebKit conform to the requirements in https://w3c.github.io/uievents/event-algo.html#fire%20key%20input%20events, https://w3c.github.io/uievents/event-algo.html#handle%20native%20paste, and https://w3c.github.io/uievents/event-algo.html#end%20composition — limiting textInput to being fired only when ending a composition or when the input type is insertText, insertParagraph, insertLineBreak, or insertFromPaste. * LayoutTests/editing/execCommand/break-out-of-empty-list-item.html: * LayoutTests/editing/inserting/typing-space-to-trigger-smart-link.html: * LayoutTests/editing/pasteboard/paste-text-events-expected.txt: * LayoutTests/editing/pasteboard/paste-text-events.html: * LayoutTests/editing/style/highlight-insert-paragraph.html: * LayoutTests/fast/events/input-events-fired-when-typing-expected.txt: * LayoutTests/fast/events/input-events-fired-when-typing-nonconforming-expected.txt: Copied from LayoutTests/fast/events/input-events-fired-when-typing-expected.txt. * LayoutTests/fast/events/input-events-fired-when-typing-nonconforming.html: Copied from LayoutTests/fast/events/input-events-fired-when-typing.html. * LayoutTests/fast/events/input-events-fired-when-typing.html: * LayoutTests/fast/events/ios/submit-form-target-blank-using-return-key-old-code-path-expected.txt: Added. * LayoutTests/fast/events/ios/submit-form-target-blank-using-return-key-old-code-path.html: Added. * LayoutTests/fast/forms/onchange-change-type.html: * LayoutTests/http/tests/navigation/keyboard-events-during-provisional-navigation-expected.txt: * LayoutTests/http/tests/navigation/keyboard-events-during-provisional-subframe-navigation-expected.txt: * LayoutTests/platform/ios/TestExpectations: * LayoutTests/platform/mac-wk2/http/tests/navigation/keyboard-events-during-provisional-navigation-expected.txt: * Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml: * Source/WebCore/editing/AlternativeTextController.cpp: (WebCore::AlternativeTextController::insertDictatedText): * Source/WebCore/editing/Editor.cpp: (WebCore::dispatchTextInputEvent): (WebCore::Editor::selectionForCommand): (WebCore::Editor::handleTextEvent): (WebCore::Editor::pasteAsPlainText): (WebCore::Editor::pasteAsFragment): (WebCore::dispatchTextInputEvents): (WebCore::Editor::appliedEditing): (WebCore::Editor::insertText): (WebCore::Editor::insertTextForConfirmedComposition): (WebCore::Editor::insertTextWithoutSendingTextEventNew): (WebCore::Editor::insertTextWithoutSendingTextEventOld): (WebCore::Editor::setComposition): (WebCore::Editor::insertTextWithoutSendingTextEvent): Deleted. * Source/WebCore/editing/Editor.h: * Source/WebCore/editing/EditorCommand.cpp: (WebCore::executeInsertBacktab): (WebCore::executeInsertLineBreak): (WebCore::executeInsertNewline): (WebCore::executeInsertTab): (WebCore::executeYank): (WebCore::executeYankAndSelect): (WebCore::enabledVisibleSelection): (WebCore::enabledVisibleSelectionAndMark): (WebCore::enableCaretInEditableText): (WebCore::enabledInEditableText): * Source/WebCore/html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::defaultEventHandler): * Source/WebCore/page/EventHandler.cpp: (WebCore::EventHandler::handleTextInput): * Source/WebCore/page/EventHandler.h:
See w3c/uievents#362 for context.
Fixes #353
The following tasks have been completed:
Implementation commitment: