Bug 1620778 - Fix interaction of up/down keys with autocomplete and <input type=number>. r=masayuki,smaug

Differential Revision: https://phabricator.services.mozilla.com/D66011
This commit is contained in:
Emilio Cobos Álvarez
2020-03-10 02:44:44 +00:00
parent 808c52f771
commit 544cca1b7b
6 changed files with 140 additions and 77 deletions

View File

@@ -950,6 +950,15 @@ TextInputListener::HandleEvent(Event* aEvent) {
return NS_ERROR_UNEXPECTED;
}
{
auto* input = HTMLInputElement::FromNode(mTxtCtrlElement);
if (input && input->StepsInputValue(*widgetKeyEvent)) {
// As an special case, don't handle key events that would step the value
// of our <input type=number>.
return NS_OK;
}
}
KeyEventHandler* keyHandlers = ShortcutKeys::GetHandlers(
mTxtCtrlElement->IsTextArea() ? HandlerType::eTextArea
: HandlerType::eInput);