Skip to content

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

@dannybeckett

Description

@dannybeckett

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).

Activity

changed the title [-]The selectmenuselect event fires when it should not[/-] [+]The selectmenuselect event fires when nothing was selected[/+] on Nov 27, 2024
changed the title [-]The selectmenuselect event fires when nothing was selected[/-] [+]The selectmenuselect event erroneously fires despite nothing being selected[/+] on Nov 27, 2024
changed the title [-]The selectmenuselect event erroneously fires despite nothing being selected[/-] [+]The selectmenuselect event erroneously fires, despite not making a selection[/+] on Nov 27, 2024
mgol

mgol commented on Nov 29, 2024

@mgol
Member

Thanks for the report. Does the issue you describe exist when jQuery UI 1.12.1 is used or only with jQuery UI 1.13.0 or newer?

dannybeckett

dannybeckett commented on Nov 29, 2024

@dannybeckett
Author

Thanks for the report. Does the issue you describe exist when jQuery UI 1.12.1 is used or only with jQuery UI 1.13.0 or newer?

The bug report from 2017 uses jQuery UI 1.11.3 - so the bug is present before 1.12.1

mgol

mgol commented on Nov 30, 2024

@mgol
Member

Thanks for the info. Since the issue is already in 1.12, given limited team resources it's not likely to be fixed by the UI team; see the project status at https://blog.jqueryui.com/2021/10/jquery-maintainers-update-and-transition-jquery-ui-as-part-of-overall-modernization-efforts/. PRs are welcome if they're not too complex and contain tests.

dannybeckett

dannybeckett commented on Nov 30, 2024

@dannybeckett
Author

Thanks for the info. Since the issue is already in 1.12, given limited team resources it's not likely to be fixed by the UI team; see the project status at https://blog.jqueryui.com/2021/10/jquery-maintainers-update-and-transition-jquery-ui-as-part-of-overall-modernization-efforts/. PRs are welcome if they're not too complex and contain tests.

Ok thanks for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @mgol@dannybeckett

        Issue actions

          The selectmenuselect event erroneously fires, despite not making a selection · Issue #2317 · jquery/jquery-ui