@stonecrop/utilities 0.3.7 → 0.3.9
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/package.json
CHANGED
|
@@ -53,7 +53,7 @@ const getTopCell = (event: KeyboardEvent) => {
|
|
|
53
53
|
const $table = $target.parentElement?.parentElement
|
|
54
54
|
if ($table) {
|
|
55
55
|
const $firstRow = $table.firstElementChild
|
|
56
|
-
const $navCell = $firstRow
|
|
56
|
+
const $navCell = $firstRow?.children[$target.cellIndex] as HTMLElement
|
|
57
57
|
if ($navCell) {
|
|
58
58
|
$topCell = $navCell
|
|
59
59
|
}
|
|
@@ -112,7 +112,7 @@ const getBottomCell = (event: KeyboardEvent) => {
|
|
|
112
112
|
const $table = $target.parentElement?.parentElement
|
|
113
113
|
if ($table) {
|
|
114
114
|
const $lastRow = $table.lastElementChild
|
|
115
|
-
const $navCell = $lastRow
|
|
115
|
+
const $navCell = $lastRow?.children[$target.cellIndex] as HTMLElement
|
|
116
116
|
if ($navCell) {
|
|
117
117
|
$bottomCell = $navCell
|
|
118
118
|
}
|
|
@@ -175,7 +175,7 @@ const _getNextCell = (element: HTMLElement): HTMLElement | undefined => {
|
|
|
175
175
|
const getFirstCell = (event: KeyboardEvent) => {
|
|
176
176
|
const $target = event.target as HTMLElement
|
|
177
177
|
const $parent = $target.parentElement
|
|
178
|
-
const $firstCell = $parent
|
|
178
|
+
const $firstCell = $parent?.firstElementChild as HTMLElement | null
|
|
179
179
|
if ($firstCell && (!isFocusable($firstCell) || !isVisible($firstCell))) {
|
|
180
180
|
return _getNextCell($firstCell)
|
|
181
181
|
}
|
|
@@ -185,7 +185,7 @@ const getFirstCell = (event: KeyboardEvent) => {
|
|
|
185
185
|
const getLastCell = (event: KeyboardEvent) => {
|
|
186
186
|
const $target = event.target as HTMLElement
|
|
187
187
|
const $parent = $target.parentElement
|
|
188
|
-
const $lastCell = $parent
|
|
188
|
+
const $lastCell = $parent?.lastElementChild as HTMLElement | null
|
|
189
189
|
if ($lastCell && (!isFocusable($lastCell) || !isVisible($lastCell))) {
|
|
190
190
|
return _getPrevCell($lastCell)
|
|
191
191
|
}
|
|
@@ -370,7 +370,7 @@ export function useKeyboardNav(options: KeyboardNavigationOptions[]) {
|
|
|
370
370
|
}
|
|
371
371
|
} else if (option.selectors instanceof HTMLElement) {
|
|
372
372
|
selectors.push(option.selectors)
|
|
373
|
-
} else {
|
|
373
|
+
} else if (option.selectors?.value) {
|
|
374
374
|
if (Array.isArray(option.selectors.value)) {
|
|
375
375
|
for (const element of option.selectors.value) {
|
|
376
376
|
if (element instanceof HTMLElement) {
|