Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,7 @@ function rerenderKeepingFilterFocus(): void {
render();
suppressTableAnimation = false;
if (key === undefined) return;
const next: any = [...el.tableHead.querySelectorAll('input[data-filter-col]')].find((node: any) => node.dataset.filterCol === key && node.dataset.filterScope === scope);
const next: any = Array.from(el.tableHead.querySelectorAll('input[data-filter-col]')).find((node: any) => node.dataset.filterCol === key && node.dataset.filterScope === scope);
if (next) { next.focus(); try { next.setSelectionRange(caret, caret); } catch { /* not a text input */ } }
});
}
Expand Down Expand Up @@ -1208,7 +1208,7 @@ function createDropdown(cfg: DropdownConfig): Dropdown {
}

function paintActive(scroll: boolean): void {
const rows: any[] = [...list.querySelectorAll('.dd-opt')];
const rows: any[] = Array.from(list.querySelectorAll('.dd-opt'));
let activeEl: any = null;
rows.forEach(row => {
const on = row.dataset.id === activeId;
Expand Down Expand Up @@ -1306,7 +1306,7 @@ function createDropdown(cfg: DropdownConfig): Dropdown {
trigger.setAttribute('aria-expanded', 'true');
input.focus({ preventScroll: true });
input.setSelectionRange(input.value.length, input.value.length);
const row: any = [...list.querySelectorAll('.dd-opt')].find((r: any) => r.dataset.id === activeId);
const row: any = Array.from(list.querySelectorAll('.dd-opt')).find((r: any) => r.dataset.id === activeId);
if (row) list.scrollTop = Math.max(0, row.offsetTop - list.offsetTop - list.clientHeight / 3);
paintActive(false);
}
Expand Down Expand Up @@ -1401,14 +1401,14 @@ function createDropdown(cfg: DropdownConfig): Dropdown {
// The panel lives at the end of <body>, so Tab at its edges hands focus back to the page order around the trigger.
panel.addEventListener('keydown', (event: any) => {
if (event.key !== 'Tab') return;
const focusable = [...panel.querySelectorAll('input, button')].filter((node: any) => node.tabIndex >= 0 && node.offsetParent !== null);
const focusable = Array.from(panel.querySelectorAll('input, button')).filter((node: any) => node.tabIndex >= 0 && node.offsetParent !== null);
if (!focusable.length) return;
const edge = event.shiftKey ? focusable[0] : focusable[focusable.length - 1];
if (event.target !== edge) return;
event.preventDefault();
close();
if (event.shiftKey) { trigger.focus({ preventScroll: true }); return; }
const page = [...document.querySelectorAll('a[href], button, input, select, textarea, [tabindex]')]
const page = Array.from(document.querySelectorAll('a[href], button, input, select, textarea, [tabindex]'))
.filter((node: any) => !panel.contains(node) && node.tabIndex >= 0 && !node.disabled && (node.offsetParent !== null || node === trigger));
const next: any = page[page.indexOf(trigger) + 1];
if (next) next.focus();
Expand Down Expand Up @@ -1444,7 +1444,7 @@ function loadHiddenColumns(): void {

function persistHiddenColumns(): void {
try {
localStorage.setItem(COLUMN_VISIBILITY_KEY, JSON.stringify([...hiddenColumns]));
localStorage.setItem(COLUMN_VISIBILITY_KEY, JSON.stringify(Array.from(hiddenColumns)));
} catch {
// Storage is blocked: the choice lasts for this page only.
}
Expand Down Expand Up @@ -1541,7 +1541,7 @@ function loadHiddenCategories(): void {

function persistHiddenCategories(): void {
try {
localStorage.setItem(HIDDEN_CATEGORIES_KEY, JSON.stringify([...hiddenCategories]));
localStorage.setItem(HIDDEN_CATEGORIES_KEY, JSON.stringify(Array.from(hiddenCategories)));
} catch {
// Storage is blocked: the choice lasts for this page only.
}
Expand Down
Loading