Bug 1008244 Don't consume Enter key at keypress event when <select size=1> has focus but its dropdown list is closed r=smaug

This commit is contained in:
Masayuki Nakano 2014-05-16 18:45:25 +09:00
Родитель 2a02941977
Коммит c73fb6d886
2 изменённых файлов: 5 добавлений и 6 удалений

Просмотреть файл

@ -2131,12 +2131,11 @@ nsListControlFrame::KeyDown(nsIDOMEvent* aKeyEvent)
break;
case NS_VK_RETURN:
if (IsInDropDownMode()) {
// If the select element is a dropdown style, Enter key should be
// consumed everytime since Enter key may be pressed accidentally after
// the dropdown is closed by Enter key press.
aKeyEvent->PreventDefault();
if (mComboboxFrame->IsDroppedDown()) {
// If the select element is a dropdown style, Enter key should be
// consumed while the dropdown is open for security.
aKeyEvent->PreventDefault();
nsWeakFrame weakFrame(this);
ComboboxFinish(mEndSelectionIndex);
if (!weakFrame.IsAlive()) {

Просмотреть файл

@ -321,7 +321,7 @@ function runTests()
reset()
synthesizeKey("VK_RETURN", {});
check(true, "Enter key on combobox");
check(false, "Enter key on combobox");
reset()
synthesizeKey("VK_ESCAPE", {});