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

set focus in search input selectBox #83

Open
stgcorpbr opened this issue Jun 2, 2022 · 1 comment
Open

set focus in search input selectBox #83

stgcorpbr opened this issue Jun 2, 2022 · 1 comment

Comments

@stgcorpbr
Copy link

should have an option that gives focus on the search input

@stgcorpbr
Copy link
Author

i add line 558
setTimeout(() => { self.inputBox.focus(); }, 500);

 if (self.userOptions.stayOpen) {
            self.drop.style.visibility = "visible";
            self.drop.classList.add('show');
            self.drop.style.boxShadow = "none";
            self.drop.style.minHeight = (this.userOptions.maxHeight + 10) + "px";
            self.drop.style.position = "relative";
            self.drop.style.left = "0px";
            self.drop.style.top = "0px";
            self.button.style.border = "none";
        } else {
            this.main.addEventListener("click", function (e) {
                if (self.isDisabled) return;
                self.drop.style.left = self.left + "px";
                self.drop.style.top = self.top + "px";
                self.drop.style.visibility = "visible";                
                self.drop.classList.add('show');
                self.drop.closest('.vsb-main').classList.add('dropdown-show');
                setTimeout(() => {
                    self.inputBox.focus();    
                }, 500);
                
                document.addEventListener("click", docListener);                
                e.preventDefault();
                e.stopPropagation();
                if (!self.userOptions.stayOpen) {
                    VSBoxCounter.closeAllButMe(self.instanceOffset);
                }
            });
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant