mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-08 00:38:39 +09:00
Issue #2019 - Do not dispatch keypress event for non-printable keys.
This will prevent the keypress DOM event from firing on keypresses that do not produce printable keys (e.g. editing nav keys) in content. This should not affect any chrome events that are in use. Event dispatch can be re-enabled if necessary with the added pref.
This commit is contained in:
parent
2f0896ab31
commit
1392f5f223
6 changed files with 48 additions and 15 deletions
|
|
@ -397,20 +397,14 @@ TextEditor::HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent)
|
|||
return TypedText(NS_LITERAL_STRING("\t"), eTypedText);
|
||||
}
|
||||
case NS_VK_RETURN:
|
||||
if (IsSingleLineEditor() || nativeKeyEvent->IsControl() ||
|
||||
nativeKeyEvent->IsAlt() || nativeKeyEvent->IsMeta() ||
|
||||
nativeKeyEvent->IsOS()) {
|
||||
if (IsSingleLineEditor() || !nativeKeyEvent->IsInputtingLineBreak()) {
|
||||
return NS_OK;
|
||||
}
|
||||
aKeyEvent->AsEvent()->PreventDefault();
|
||||
return TypedText(EmptyString(), eTypedBreak);
|
||||
}
|
||||
|
||||
// NOTE: On some keyboard layout, some characters are inputted with Control
|
||||
// key or Alt key, but at that time, widget sets FALSE to these keys.
|
||||
if (!nativeKeyEvent->mCharCode || nativeKeyEvent->IsControl() ||
|
||||
nativeKeyEvent->IsAlt() || nativeKeyEvent->IsMeta() ||
|
||||
nativeKeyEvent->IsOS()) {
|
||||
if (!nativeKeyEvent->IsInputtingText()) {
|
||||
// we don't PreventDefault() here or keybindings like control-x won't work
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue