File tree Expand file tree Collapse file tree 1 file changed +5
-10
lines changed
Expand file tree Collapse file tree 1 file changed +5
-10
lines changed Original file line number Diff line number Diff line change @@ -566,20 +566,15 @@ export default class Select {
566566 const labelClickHandler = ( e : MouseEvent ) => {
567567 const target = e . target as HTMLElement
568568
569- // Only continue if the target is the label
570- if ( target !== label ) {
571- return
572- }
573-
574- // At this point, we know the click is directly on the label element
575569 // Prevent default label behavior (focusing the select)
576- // Don't stop propagation to allow other handlers (like closing other SlimSelect instances)
570+ // This needs to happen for all clicks on the label or its children
571+ // to prevent the browser from focusing the hidden select
577572 e . preventDefault ( )
578573 // e.stopPropagation() // dont stop propagation
579574
580- // Trigger the callback to toggle SlimSelect
581- if ( this . onLabelClick ) {
582- this . onLabelClick ! ( )
575+ // Only handle the click if it's directly on the label
576+ if ( target === label && this . onLabelClick ) {
577+ this . onLabelClick ( )
583578 }
584579 }
585580
You can’t perform that action at this time.
0 commit comments