File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -192,7 +192,9 @@ export const Picklist: (<MultiSelect extends boolean | undefined>(
192192 if ( ! currentValue ) return optionValues [ 0 ] ;
193193
194194 const currentIndex = optionValues . indexOf ( currentValue ) ;
195- return optionValues [ currentIndex + 1 ] || optionValues [ 0 ] ; // wrap around
195+ return optionValues [
196+ Math . min ( currentIndex + 1 , optionValues . length - 1 )
197+ ] ; // not wrap around
196198 } ,
197199 [ getOptionValues ]
198200 ) ;
@@ -206,10 +208,7 @@ export const Picklist: (<MultiSelect extends boolean | undefined>(
206208 if ( ! currentValue ) return optionValues [ optionValues . length - 1 ] ;
207209
208210 const currentIndex = optionValues . indexOf ( currentValue ) ;
209- return (
210- optionValues [ currentIndex - 1 ] ||
211- optionValues [ optionValues . length - 1 ]
212- ) ; // wrap around
211+ return optionValues [ Math . max ( currentIndex - 1 , 0 ) ] ; // not wrap around
213212 } ,
214213 [ getOptionValues ]
215214 ) ;
You can’t perform that action at this time.
0 commit comments