Skip to content

Skip non selectable items #456

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: feature/v5
Choose a base branch
from
Draft
Changes from 1 commit
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
Prev Previous commit
Skip non selectable items
  • Loading branch information
b3ngg committed Aug 11, 2022
commit 1daac1e01491ecce22d0fd7c749054854d2031ca
12 changes: 6 additions & 6 deletions src/lib/Select.svelte
Original file line number Diff line number Diff line change
@@ -259,7 +259,7 @@
filterGroupedItems,
});

$: if (filteredItems) hoverItemIndex = 0;
$: if (filteredItems) setHoverIndex(0);

beforeUpdate(async () => {
prev_value = value;
@@ -357,9 +357,9 @@
e.preventDefault();

if (listOpen) {
setHoverIndex(1);
changeHoverIndex(1);
} else {
hoverItemIndex = 0;
setHoverIndex(0);
listOpen = true;
activeValue = undefined;
}
@@ -369,7 +369,7 @@
e.preventDefault();

if (listOpen) {
setHoverIndex(-1);
changeHoverIndex(-1);
} else {
listOpen = true;
activeValue = undefined;
@@ -438,7 +438,7 @@

function handleClick() {
if (disabled) return;
hoverItemIndex = 0;
setHoverIndex(0);
listOpen = !listOpen;
if (listOpen && !focused) handleFocus();
}
@@ -551,7 +551,7 @@

function handleHover(i) {
if (isScrolling) return;
hoverItemIndex = i;
setHoverIndex(i);
}

function handleItemClick(args) {