@solidtv/solid 1.8.0 → 1.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/core/focusManager.js +2 -1
- package/dist/src/core/focusManager.js.map +1 -1
- package/dist/src/primitives/utils/handleNavigation.js +15 -4
- package/dist/src/primitives/utils/handleNavigation.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/core/focusManager.ts +2 -1
- package/src/primitives/utils/handleNavigation.ts +25 -4
package/package.json
CHANGED
package/src/core/focusManager.ts
CHANGED
|
@@ -460,7 +460,8 @@ const propagateKeyPress = (
|
|
|
460
460
|
const eventHandler = elm[eventHandlerKey];
|
|
461
461
|
if (isFunction(eventHandler)) {
|
|
462
462
|
lastHandlerSeen = elm;
|
|
463
|
-
handled =
|
|
463
|
+
handled =
|
|
464
|
+
eventHandler.call(elm, e, elm, finalFocusElm, mappedEvent) === true;
|
|
464
465
|
}
|
|
465
466
|
}
|
|
466
467
|
if (!handled && !isUp) {
|
|
@@ -218,10 +218,20 @@ export function handleNavigation(
|
|
|
218
218
|
* >
|
|
219
219
|
* ```
|
|
220
220
|
*/
|
|
221
|
-
export const navigableHandleNavigation: lng.KeyHandler = function (
|
|
221
|
+
export const navigableHandleNavigation: lng.KeyHandler = function (
|
|
222
|
+
e,
|
|
223
|
+
_target,
|
|
224
|
+
_handlerElm,
|
|
225
|
+
mappedEvent,
|
|
226
|
+
) {
|
|
227
|
+
// The key map's name for the key, so that a key mapped to a direction
|
|
228
|
+
// under another name (an Xbox D-pad's GamepadDPadLeft) moves that way.
|
|
229
|
+
const key = mappedEvent || e.key;
|
|
222
230
|
return moveSelection(
|
|
223
231
|
this as lngp.NavigableElement,
|
|
224
|
-
|
|
232
|
+
key === 'Up' || key === 'Left' || key === 'ArrowUp' || key === 'ArrowLeft'
|
|
233
|
+
? -1
|
|
234
|
+
: 1,
|
|
225
235
|
);
|
|
226
236
|
};
|
|
227
237
|
|
|
@@ -345,7 +355,12 @@ export const spatialForwardFocus: lng.ForwardFocusHandler = function () {
|
|
|
345
355
|
* >
|
|
346
356
|
* ```
|
|
347
357
|
*/
|
|
348
|
-
export const spatialHandleNavigation: lng.KeyHandler = function (
|
|
358
|
+
export const spatialHandleNavigation: lng.KeyHandler = function (
|
|
359
|
+
e,
|
|
360
|
+
_target,
|
|
361
|
+
_handlerElm,
|
|
362
|
+
mappedEvent,
|
|
363
|
+
) {
|
|
349
364
|
let selected = this.selected;
|
|
350
365
|
|
|
351
366
|
if (typeof selected !== 'number' || !idxInArray(selected, this.children)) {
|
|
@@ -356,16 +371,22 @@ export const spatialHandleNavigation: lng.KeyHandler = function (e) {
|
|
|
356
371
|
const prevChild = this.children[selected]!;
|
|
357
372
|
|
|
358
373
|
const move = { x: 0, y: 0 };
|
|
359
|
-
|
|
374
|
+
// The key map's name for the key, so that a key mapped to a direction
|
|
375
|
+
// under another name (an Xbox D-pad's GamepadDPadRight) is recognised.
|
|
376
|
+
switch (mappedEvent || e.key) {
|
|
377
|
+
case 'Left':
|
|
360
378
|
case 'ArrowLeft':
|
|
361
379
|
move.x = -1;
|
|
362
380
|
break;
|
|
381
|
+
case 'Right':
|
|
363
382
|
case 'ArrowRight':
|
|
364
383
|
move.x = 1;
|
|
365
384
|
break;
|
|
385
|
+
case 'Up':
|
|
366
386
|
case 'ArrowUp':
|
|
367
387
|
move.y = -1;
|
|
368
388
|
break;
|
|
389
|
+
case 'Down':
|
|
369
390
|
case 'ArrowDown':
|
|
370
391
|
move.y = 1;
|
|
371
392
|
break;
|