Closed Bug 1593366 Opened 8 months ago Closed 8 months ago

Select popup shows up on keydown even when event is default prevented.

Categories

(Core :: Layout: Form Controls, defect, P3)

70 Branch
defect

Tracking

()

RESOLVED FIXED
mozilla72
Tracking Status
firefox72 --- fixed

People

(Reporter: marioposilva, Assigned: emilio)

Details

Attachments

(2 files)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:70.0) Gecko/20100101 Firefox/70.0

Steps to reproduce:

Focus hidden tag select and press spacebar key.

(Select css:
select {
position: absolute;
bottom: 0;
left: 50%;
display: inline-block;
width: 0;
height: 0;
padding: 0;
opacity: 0;
border: none;
overflow:hidden;
}
)

Actual results:

The hidden select shows the dropdown options.

Expected results:

Dropdown options should remain hidden.

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Component: Untriaged → Layout: Form Controls
Product: Firefox → Core

Could you attach an HTML page that shows the bug? Also why is this the expected result? If it is focusable, I'd expect the user to be able to use it.

Flags: needinfo?(marioposilva)
(In reply to Emilio Cobos Álvarez (:emilio) from comment #2)
> Could you attach an HTML page that shows the bug? Also why is this the expected result? If it is focusable, I'd expect the user to be able to use it.

(In reply to Emilio Cobos Álvarez (:emilio) from comment #2)

Could you attach an HTML page that shows the bug? Also why is this the expected result? If it is focusable, I'd expect the user to be able to use it.

You can test it on Chrome and Firefox, in Chrome, if you press TAB > Spacebar, it will open the masked dropdown and won't show the native dropdown.
When doing it on Firefox, it will show the native dropdown.

Flags: needinfo?(marioposilva)
Attachment #9106835 - Attachment mime type: text/plain → text/html

Ah, cool, so the issue is that we show the dropdown even if you call e.preventDefault(). I agree that's a bug, but it doesn't have to do with being hidden or not :)

So a reduced test-case would be: data:text/html,<select onkeydown="return false"><option>Foo</option><option>Bar</option></select>.

That doesn't show the dropdown in other browsers, but it does in Firefox.

Status: UNCONFIRMED → NEW
Type: enhancement → defect
Ever confirmed: true
Priority: -- → P3
Summary: Hidden select when spacebar is pressed, dropdown options appear in browser → Select popup shows up on keydown even when event is default prevented.
Assignee: nobody → emilio
Pushed by ealvarez@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/90da3a622fbf
Check default prevented status in nsListControlFrame::KeyDown. r=mats
Status: NEW → RESOLVED
Closed: 8 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla72
You need to log in before you can comment on or make changes to this bug.