|
243 | 243 | return; |
244 | 244 | } |
245 | 245 |
|
246 | | - function getFocusableSibling(container, isPrev, startA) { |
| 246 | + function getFocusableSibling(container, isBackward, startA) { |
247 | 247 | if (!container) { |
248 | 248 | return |
249 | 249 | } |
|
255 | 255 | startLI = startLI.parentElement; |
256 | 256 | } |
257 | 257 | if (!startLI) { |
258 | | - if (isPrev) { |
| 258 | + if (isBackward) { |
259 | 259 | startLI = container.firstElementChild; |
260 | 260 | } else { |
261 | 261 | startLI = container.lastElementChild; |
|
267 | 267 |
|
268 | 268 | var siblingLI = startLI; |
269 | 269 | do { |
270 | | - if (isPrev) { |
| 270 | + if (isBackward) { |
271 | 271 | siblingLI = siblingLI.previousElementSibling; |
272 | 272 | if (!siblingLI) { |
273 | 273 | siblingLI = container.lastElementChild; |
|
303 | 303 | return a; |
304 | 304 | } |
305 | 305 |
|
306 | | - function getMatchedFocusableSibling(container, isPrev, startA, buf) { |
| 306 | + function getMatchedFocusableSibling(container, isBackward, startA, buf) { |
307 | 307 | var skipRound = buf.length === 1; // find next prefix |
308 | 308 | var matchKeyA; |
309 | 309 | var firstCheckA; |
|
334 | 334 | if (buf.length <= textContent.length && textContent.substring(0, buf.length) === buf) { |
335 | 335 | return a; |
336 | 336 | } |
337 | | - } while (a = getFocusableSibling(container, isPrev, a)); |
| 337 | + } while (a = getFocusableSibling(container, isBackward, a)); |
338 | 338 | return matchKeyA; |
339 | 339 | } |
340 | 340 |
|
|
376 | 376 | lookupTimer = setTimeout(clearLookupContext, 850); |
377 | 377 | } |
378 | 378 |
|
379 | | - function lookup(key) { |
| 379 | + function lookup(key, isBackward) { |
380 | 380 | key = key.toLowerCase(); |
381 | 381 |
|
382 | 382 | var currentLookupStartA; |
|
397 | 397 | lookupBuffer += key; |
398 | 398 | } |
399 | 399 | delayClearLookupContext(); |
400 | | - return getMatchedFocusableSibling(itemList, false, currentLookupStartA, lookupKey || lookupBuffer); |
| 400 | + return getMatchedFocusableSibling(itemList, isBackward, currentLookupStartA, lookupKey || lookupBuffer); |
401 | 401 | } |
402 | 402 |
|
403 | 403 | var canArrowMove; |
|
457 | 457 | } |
458 | 458 | } |
459 | 459 | if (!e.ctrlKey && (!e.altKey || IS_MAC_PLATFORM) && !e.metaKey && e.key.length === 1) { |
460 | | - return lookup(e.key); |
| 460 | + return lookup(e.key, e.shiftKey); |
461 | 461 | } |
462 | 462 | } else if (e.keyCode) { |
463 | 463 | if (canArrowMove(e)) { |
|
489 | 489 | } |
490 | 490 | } |
491 | 491 | if (!e.ctrlKey && (!e.altKey || IS_MAC_PLATFORM) && !e.metaKey && e.keyCode >= 32 && e.keyCode <= 126) { |
492 | | - return lookup(String.fromCharCode(e.keyCode)); |
| 492 | + return lookup(String.fromCharCode(e.keyCode), e.shiftKey); |
493 | 493 | } |
494 | 494 | } |
495 | 495 | } |
|
0 commit comments