Skip to content
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

fix: remove pointer-events style from multiselect dropdown #1654

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
15 changes: 13 additions & 2 deletions src/MultiSelect/MultiSelect.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@
let initialSorted = false;
let highlightedIndex = -1;
let prevChecked = [];
let inputFocused = false;

setContext("MultiSelect", {
declareRef: ({ key, ref }) => {
Expand Down Expand Up @@ -316,6 +317,7 @@
class="bx--multi-select {direction === 'top' &&
'bx--list-box--up'} {filterable && 'bx--combo-box'}
{filterable && 'bx--multi-select--filterable'}
{filterable && inputFocused && 'bx--multi-select--filterable--input-focused'}
{invalid && 'bx--multi-select--invalid'}
{inline && 'bx--multi-select--inline'}
{checked.length > 0 && 'bx--multi-select--selected'}"
Expand Down Expand Up @@ -375,7 +377,6 @@
}}"
on:focus="{() => {
if (filterable) {
open = true;
if (inputRef) inputRef.focus();
}
}}"
Expand Down Expand Up @@ -417,6 +418,11 @@
class:bx--text-input="{true}"
class:bx--text-input--empty="{value === ''}"
class:bx--text-input--light="{light}"
on:input="{() => {
if (!open) {
open = true;
}
}}"
on:keydown
on:keydown|stopPropagation="{({ key }) => {
if (key === 'Enter') {
Expand Down Expand Up @@ -444,7 +450,13 @@
}}"
on:keyup
on:focus
on:focus="{() => {
inputFocused = true;
}}"
on:blur
on:blur="{() => {
inputFocused = false;
}}"
on:paste
disabled="{disabled}"
placeholder="{placeholder}"
Expand All @@ -466,7 +478,6 @@
/>
{/if}
<ListBoxMenuIcon
style="pointer-events: {open ? 'auto' : 'none'}"
on:click="{(e) => {
e.stopPropagation();
open = !open;
Expand Down