Open Bug 1692932 Opened 5 years ago Updated 5 years ago

Hiding a select element suppresses pending change event

Categories

(Core :: DOM: Events, defect, P3)

Firefox 85
defect

Tracking

()

People

(Reporter: desmond.allan.schmidt, Unassigned)

References

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:85.0) Gecko/20100101 Firefox/85.0

Steps to reproduce:

I wanted a dropdown menu for a toolbar composed of a button and a select menu. The select menu would appear directly below the button when it was clicked, then the user would choose a value, and the select menu would hide itself again. This was achieved with a) a click-handler on the button which un-hides the select menu b) a mouseup event handler on the select menu which hides the menu when any option is selected and c) a change event handler also attached to the select menu. The mouseup event fires, hiding the select menu, and in the case of a new value being selected a change event should also be fired, to be picked up subsequently by the change event handler. Since change is undetectable in the mouseup handler a separate change handler is needed.

Actual results:

The change event is never fired even when the value differs from the old one. Removing the hiding in the mouseup handler restores the change event, so it is the hiding, either with display:none or visibility:hidden that causes the problem.

Expected results:

In Chrome and Opera this works correctly: the change event is fired because the select menu has changed. Merely hiding a select should not kill pending change events. Version 85 is the latest version on Linux.

Attached file dochange.html —

The Bugbug bot thinks this bug should belong to the 'Core::Widget: Gtk' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.

Component: Untriaged → Widget: Gtk
Product: Firefox → Core
Comment on attachment 9203327 [details] dochange.html ><!DOCTYPE html> ><html> ><meta charset="utf-8"> ><head> ><style> >#dropdown {display:none;} ></style> ><script> >function dochange(event){ > alert(event.target.value); >} >function display_menu(){ > let dropdown = document.getElementById("dropdown"); > dropdown.setAttribute("style","display:block"); >} >function hide_menu(){ > let dropdown = document.getElementById("dropdown"); > dropdown.setAttribute("style","display:none"); >} ></script> ></head> ><body> ><div><input type="button" id="formats" value="food" onclick="display_menu()"></input><br><select size="8" onmouseup="hide_menu()" onchange="dochange(event)" id="dropdown"><optgroup label="fruit"><option selected>pear</option><option>apple</option><option>banana</option></optgroup><optgroup label="vegetables"><option>potato</option><option>carrot</option><option>broccoli</option></optgroup></select></div> ></body> ></html>
Component: Widget: Gtk → DOM: Events

Thanks for reporting this issue. Could reproduce it on Ubuntu 18.04 with current Nightly.

Status: UNCONFIRMED → NEW
Ever confirmed: true
Severity: -- → S3
Priority: -- → P3
See Also: → 1006480
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: