Skip to content

Commit

Permalink
fix(supersearch): prevent changing col if no row is selected
Browse files Browse the repository at this point in the history
johanbissemattsson committed Jan 15, 2025

Unverified

No user is associated with the committer email.
1 parent 666663d commit dcc33db
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lxl-web/src/lib/components/Search.svelte
Original file line number Diff line number Diff line change
@@ -106,7 +106,7 @@
>
{#snippet resultItem(item, getCellId, isFocusedCell)}
<a
href={relativizeUrl(item['@id'])}
href={relativizeUrl(item?.['@id'])}
role="gridcell"
id={getCellId(0)}
class:focused-cell={isFocusedCell(0)}
7 changes: 5 additions & 2 deletions packages/supersearch/src/lib/components/SuperSearch.svelte
Original file line number Diff line number Diff line change
@@ -250,12 +250,15 @@
}
break;
case 'ArrowLeft':
if (activeColIndex > 0) {
if (activeRowIndex >= 0 && activeColIndex > 0) {
activeColIndex--;
}
break;
case 'ArrowRight':
if (activeColIndex < getColsInActiveRow(activeRowIndex).length - 1) {
if (
activeRowIndex >= 0 &&
activeColIndex < getColsInActiveRow(activeRowIndex).length - 1
) {
activeColIndex++;
}
break;

0 comments on commit dcc33db

Please sign in to comment.