The selectmenuselect event erroneously fires, despite not making a selection

Aperta
#2,317 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
javascript, jquery
Ambito
frontend

Direzione di ricerca

Riproduci l’evento utilizzando il jsbin o jsfiddle collegato, incluso il passaggio del cursore sulle opzioni prima di fare clic al di fuori del menu a discesa, e confronta il comportamento con il ticket storico. Traccia il punto di ingresso dell’evento selectmenuselect e aggiungi una copertura di regressione che dimostri che la chiusura senza una selezione non lo attiva; verifica che le selezioni effettive continuino ad attivarlo.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Behavior shared with 1.12 Comp: Selectmenu

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

Lingua principale
JavaScript
Stelle
11.3k
Fork
5.2k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di jquery/jquery-ui

Tutte le issue di jquery/jquery-ui

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.