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

Focus input box on website load #10

Closed
olfMombach opened this issue Dec 20, 2024 · 3 comments
Closed

Focus input box on website load #10

olfMombach opened this issue Dec 20, 2024 · 3 comments

Comments

@olfMombach
Copy link

olfMombach commented Dec 20, 2024

Hello,
when loading the site the central input box is not focused. For people that heavily use the keyboard and shortcuts, manually selecting the box using the mouse is an additional step. Therefore I would suggest using the HTMLElement.focus() method in Javascript or similar to make the browser focus the element after loading the website, requiring no additional mouse input.

The approach I was thinking of would be something like

document.addEventListener("DOMContentLoaded", function() {
            let textBox = document.getElementById("v");  // in some way get the text box
            textBox.focus();
});
mozq added a commit that referenced this issue Dec 21, 2024
@mozq
Copy link
Owner

mozq commented Dec 21, 2024

@olfMombach,
This change has been deployed to https://dencode.com/ .

I remembered that I had removed this feature in the past because the software keyboard is displayed on mobile devices.
When I try it on my iPhone, there seems to be no problem at the moment, but I might add a condition regarding whether it is a mobile device or not.

Please let me know if you have any good solution.

mozq added a commit that referenced this issue Dec 21, 2024
@mozq
Copy link
Owner

mozq commented Dec 21, 2024

@olfMombach,
Fixed to focus only on non-touch devices. This change has been deployed to https://dencode.com/ .

@olfMombach
Copy link
Author

Good solution with the mobile detection, works well on my Laptop. Thanks for the enhancement.

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

No branches or pull requests

2 participants