File tree Expand file tree Collapse file tree 1 file changed +5
-16
lines changed
src/tpl/defaultTheme/frontend Expand file tree Collapse file tree 1 file changed +5
-16
lines changed Original file line number Diff line number Diff line change 239
239
if ( ! startA ) {
240
240
startA = container . querySelector ( ':focus' ) ;
241
241
}
242
- var startLI = startA ;
243
- while ( startLI && startLI . tagName !== 'LI' ) {
244
- startLI = startLI . parentElement ;
245
- }
242
+ var startLI = startA && startA . closest ( 'li' ) ;
246
243
if ( ! startLI ) {
247
244
if ( isBackward ) {
248
245
startLI = container . firstElementChild ;
257
254
var siblingLI = startLI ;
258
255
do {
259
256
if ( isBackward ) {
260
- siblingLI = siblingLI . previousElementSibling ;
261
- if ( ! siblingLI ) {
262
- siblingLI = container . lastElementChild ;
263
- }
257
+ siblingLI = siblingLI . previousElementSibling || container . lastElementChild ;
264
258
} else {
265
- siblingLI = siblingLI . nextElementSibling ;
266
- if ( ! siblingLI ) {
267
- siblingLI = container . firstElementChild ;
268
- }
259
+ siblingLI = siblingLI . nextElementSibling || container . firstElementChild ;
269
260
}
270
261
} while ( siblingLI !== startLI && (
271
262
siblingLI . classList . contains ( classNone ) ||
290
281
}
291
282
292
283
function getMatchedFocusableSibling ( container , isBackward , startA , buf ) {
293
- var skipRound = buf . length === 1 ; // find next prefix
294
- var matchKeyA ;
284
+ var skipRound = buf . length === 1 ; // find next single-char prefix
295
285
var firstCheckA ;
296
286
var secondCheckA ;
297
287
var a = startA ;
317
307
}
318
308
319
309
var textContent = ( a . querySelector ( '.name' ) || a ) . textContent . toLowerCase ( ) ;
320
- if ( buf . length <= textContent . length && textContent . substring ( 0 , buf . length ) === buf ) {
310
+ if ( textContent . startsWith ( buf ) ) {
321
311
return a ;
322
312
}
323
313
} while ( a = getFocusableSibling ( container , isBackward , a ) ) ;
324
- return matchKeyA ;
325
314
}
326
315
327
316
var ARROW_UP = 'ArrowUp' ;
You can’t perform that action at this time.
0 commit comments