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

Autofocus even when autofocus is set to false #354

Closed
slinkymanbyday opened this issue Aug 28, 2024 · 3 comments · Fixed by #358
Closed

Autofocus even when autofocus is set to false #354

slinkymanbyday opened this issue Aug 28, 2024 · 3 comments · Fixed by #358
Labels
bug Something isn't working

Comments

@slinkymanbyday
Copy link

When creating a dropdown with the below code:
VirtualSelect.init({ ele: this, search: true, zIndex: 1000, maxWidth: maxWidth, autofocus: false });

The page autofocuses to the dropdown element.

This issue appears to only happen in 1.0.45
I have tested versions going back to 1.0.40, and prior versions seems to be ok.
My guess is it has to do with this line: https://github.com/sa-si-dev/virtual-select/pull/350/files#diff-7075f90f187d4b281f22b3136982040883bc7595e92f73267c6e47868729dd64R2359

commenting it out on version 1.0.45 seems to solve the issue, however I'm not proficient in JS enough to dig deeper than that.

@gnbm gnbm added the bug Something isn't working label Sep 16, 2024
@gnbm
Copy link
Collaborator

gnbm commented Sep 17, 2024

@slinkymanbyday I was also able to reproduce a similar issue but only when the dropdown has initial values.
Could you share a sample in codepen or similar with your particular use case?

@slinkymanbyday
Copy link
Author

it happens when I'm setting initial values, I just noticed the silentInitialValueSet param. I'll try that and see if it helps

@slinkymanbyday
Copy link
Author

Can confirm that silentInitialValueSet has worked for me. still kinda strange that focus happens when this value is true, but since it's working happy for this issue to be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants