File tree Expand file tree Collapse file tree 2 files changed +16
-11
lines changed
src/components/form-inputs/dropdown Expand file tree Collapse file tree 2 files changed +16
-11
lines changed Original file line number Diff line number Diff line change @@ -1497,15 +1497,19 @@ var Dropdown = function (_DropdownBase2) {
14971497 $ ( this . $el ) . find ( 'input.search' ) . on ( 'blur' , function ( e ) {
14981498 var text = $ ( e . target ) . val ( ) ;
14991499 if ( text ) {
1500- text = text . trim ( ) . toUpperCase ( ) ;
1501- var val = _this2 . sui ( 'get value' ) ;
1502- $ ( _this2 . $el ) . find ( '.menu' ) . children ( '.item' ) . each ( function ( i , el ) {
1503- if ( el . textContent . trim ( ) . toUpperCase ( ) . startsWith ( text ) ) {
1504- val = $ ( el ) . data ( 'value' ) ;
1505- }
1506- } ) ;
1507- _this2 . sui ( 'set selected' , val ) ;
1508- $ ( e . target ) . val ( '' ) ;
1500+ ( function ( ) {
1501+ text = text . trim ( ) . toUpperCase ( ) ;
1502+ var val = _this2 . sui ( 'get value' ) ;
1503+ var foundFirstMatch = false ;
1504+ $ ( _this2 . $el ) . find ( '.menu' ) . children ( '.item' ) . each ( function ( i , el ) {
1505+ if ( ! foundFirstMatch && el . textContent . trim ( ) . toUpperCase ( ) . startsWith ( text ) ) {
1506+ val = $ ( el ) . data ( 'value' ) ;
1507+ foundFirstMatch = true ;
1508+ }
1509+ } ) ;
1510+ _this2 . sui ( 'set selected' , val ) ;
1511+ $ ( e . target ) . val ( '' ) ;
1512+ } ) ( ) ;
15091513 }
15101514 } ) ;
15111515 // make up data validate attr
Original file line number Diff line number Diff line change @@ -72,10 +72,11 @@ export class Dropdown extends _DropdownBase {
7272 if ( text ) {
7373 text = text . trim ( ) . toUpperCase ( )
7474 let val = this . sui ( 'get value' )
75-
75+ let foundFirstMatch = false
7676 $ ( this . $el ) . find ( '.menu' ) . children ( '.item' ) . each ( function ( i , el ) {
77- if ( el . textContent . trim ( ) . toUpperCase ( ) . startsWith ( text ) ) {
77+ if ( ! foundFirstMatch && el . textContent . trim ( ) . toUpperCase ( ) . startsWith ( text ) ) {
7878 val = $ ( el ) . data ( 'value' )
79+ foundFirstMatch = true
7980 }
8081 } )
8182
You can’t perform that action at this time.
0 commit comments