File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -2772,8 +2772,10 @@ function search(field, listId = null) {
27722772 field . nextElementSibling . style . display = ( field . value !== '' ) ? 'block' : 'none' ;
27732773 if ( ! listId ) return ;
27742774
2775+ const search = field . value !== '' ;
2776+
27752777 // clear filter if searching in fxlist
2776- if ( listId === 'fxlist' && field . value !== '' ) {
2778+ if ( listId === 'fxlist' && search ) {
27772779 gId ( "filters" ) . querySelectorAll ( "input[type=checkbox]" ) . forEach ( ( e ) => { e . checked = false ; } ) ;
27782780 }
27792781
@@ -2807,6 +2809,12 @@ function search(field, listId = null) {
28072809 sortedListItems . forEach ( item => {
28082810 gId ( listId ) . append ( item ) ;
28092811 } ) ;
2812+
2813+ // scroll to first search result
2814+ const firstVisibleItem = sortedListItems . find ( item => item . style . display !== 'none' && ! item . classList . contains ( 'sticky' ) && ! item . classList . contains ( 'selected' ) ) ;
2815+ if ( firstVisibleItem && search ) {
2816+ firstVisibleItem . scrollIntoView ( { behavior : "instant" , block : "center" } ) ;
2817+ }
28102818}
28112819
28122820function clean ( clearButton ) {
You can’t perform that action at this time.
0 commit comments