ai / keyux

JS library to improve keyboard UI of web apps
https://ai.github.io/keyux/
MIT License
391 stars 18 forks source link

Focus `input` with shortcut key #24

Closed Hydhen closed 1 month ago

Hydhen commented 1 month ago

Hello,

I'm working on a search engine which means I have an input that will always be visible to the user Would it be possible to focus the input with a binding?

For instance aria-keyshortcuts="alt+b" act as a click on a button (clickable element?) and a focus on any other element?

I can work with a dedicated code for this, but I'd rather regroup everything under the same library to manage input bindings

ai commented 1 month ago

Now we only click https://github.com/ai/keyux/blob/main/hotkey.js#L97

But I agree that we should add focus for text elements.

Can you check maybe click already do focus for text element? If not, we can add this feature (do you want to send PR to save your name in the project history? It will be a simple few lines + tests PR)

ai commented 1 month ago

The feature was released in 0.8.