Skip to content

The selectmenuselect event erroneously fires, despite not making a selection #2317

Open
@dannybeckett

Description

This is the same exact bug from 2017 which was filed at https://bugs.jqueryui.com/ticket/15115/#comment:1

The comment is more accurate than the OP's post.

The OP gives an example at http://jsbin.com/cubulifice/edit?html,js,console,output

If you open the dropdown menu, then click outside of the dropdown to close it, and rinse and repeat a few times - the event fires, even though nothing was selected.

This can be fixed by inserting this code after function() { :

if($('#speed-menu .ui-menu-item').is(':hidden')) {
  console.log('Ignoring erroneous selection');
  return;
}

Similarly, here is my own example: https://jsfiddle.net/eucq05ok/

In my own tests, it is easier to reproduce the bug if you hover over some of the options before clicking outside of the dropdown.

This can be fixed by inserting the same code, but changing #speed-menu to #area-menu.

I observed this bug on the latest version of jQuery (3.7.1) and the latest version of jQuery UI (1.14.1).

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions