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

Options not showing after calling focus on input #289

Open
trumpet7347 opened this issue May 13, 2024 · 1 comment
Open

Options not showing after calling focus on input #289

trumpet7347 opened this issue May 13, 2024 · 1 comment
Labels
bug Something isn't working needs investigation Requires troubleshooting and diagnosing to decide action steps

Comments

@trumpet7347
Copy link

I have a multiselect panel setup like so

<MultiSelect bind:this={msApiClaims} id="msApiClaims" bind:selected={selectedApiClaims} options={options} />

By default, the input is hidden, but once it actually exists, I am calling focus to it

  $:{
        if (msApiClaims != null) {
            let inputElement = document.getElementById("msApiClaims")
            inputElement.focus();            
        }
    }

The issue I am having is that when I call focus, it doesn't show the dropdown and I am unable to select any options until I either click on the input, or tab out and back in. Is there a recommended way of pulling focus to the element programmatically, or maybe a method that can be called to display the dropdown?

@trumpet7347 trumpet7347 added the bug Something isn't working label May 13, 2024
@janosh
Copy link
Owner

janosh commented May 19, 2024

thanks for reporting, i'm surprised the dropdown doesn't open when programmatically focusing the input. i'd have to do some troubleshooting and currently lack the time. maybe next weekend.

fwiw, no need for document.getElementById("msApiClaims"). you can directly <MultiSelect bind:input={select_input} />

@janosh janosh added the needs investigation Requires troubleshooting and diagnosing to decide action steps label May 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs investigation Requires troubleshooting and diagnosing to decide action steps
Projects
None yet
Development

No branches or pull requests

2 participants