File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -172,10 +172,14 @@ function shouldCommit(details: Element, event: Event) {
172
172
const menuitem = target . closest ( '[role="menuitem"], [role="menuitemradio"]' )
173
173
if ( ! menuitem ) return
174
174
175
+ const input = menuitem . querySelector ( 'input' )
176
+
175
177
// Ignore double event caused by inputs nested in labels
176
- if ( menuitem . tagName === 'LABEL' && target !== menuitem ) return
178
+ // Known issue: This will wrongly ignore a legit click event on an already checked input,
179
+ // but inputs are not expected to be visible in the menu items.
180
+ // I've found no way to discriminate the legit event from the echo one, and we don't want to trigger the selected event twice.
181
+ if ( menuitem . tagName === 'LABEL' && target === input ) return
177
182
178
- const input = menuitem . querySelector ( 'input' )
179
183
// An input inside a label will be committed as a change event (we assume it's a radio input),
180
184
// unless the input is already checked, so we need to commit on click (to close the popup)
181
185
const onlyCommitOnChangeEvent = menuitem . tagName === 'LABEL' && input && ! input . checked
You can’t perform that action at this time.
0 commit comments