mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-08-15 17:03:07 +09:00
Issue #2532 - Don't do PreventDefault for escape key if <select> dropdown is not shown
We always use PreventDefault for <select> element, which is problematic if modal dialog is on as it prevents cancelling the dialog. We fix it by not blocking the default action if <select> is not shown. See Bug 1649278
This commit is contained in:
parent
f50948c82a
commit
368ee51d86
1 changed files with 11 additions and 2 deletions
|
|
@ -2236,11 +2236,20 @@ nsListControlFrame::KeyDown(nsIDOMEvent* aKeyEvent)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// We don't want to preventDefault for escape key if the dropdown
|
||||
// popup is not shown.
|
||||
// Need to do the check before AboutToRollup because AboutToRollup
|
||||
// may update the dropdown flags.
|
||||
bool doPreventDefault =
|
||||
!mComboboxFrame || mComboboxFrame->IsDroppedDownOrHasParentPopup();
|
||||
|
||||
AboutToRollup();
|
||||
// If the select element is a dropdown style, Enter key should be
|
||||
// If the select element is a dropdown style, Escape key should be
|
||||
// consumed everytime since Escape key may be pressed accidentally after
|
||||
// the dropdown is closed by Escepe key.
|
||||
aKeyEvent->PreventDefault();
|
||||
if (doPreventDefault) {
|
||||
aKeyEvent->PreventDefault();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
case NS_VK_PAGE_UP: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue