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

Simplify handling of keyboard input #311

Open
wabain opened this issue Mar 6, 2016 · 0 comments
Open

Simplify handling of keyboard input #311

wabain opened this issue Mar 6, 2016 · 0 comments

Comments

@wabain
Copy link
Contributor

wabain commented Mar 6, 2016

Currently, Diva listens for keydown events on the document for its keyboard controls features, and tries to track whether the last click on the page was within a Diva instance to decide whether a given instance should handle the key press. It just occurred to me that a better way to handle this might be to set tabindex on the diva-outer element so that it can receive focus, and then listen for events there. I think that would give the expected behaviour, and also handle some other cases, like when the user changes focus by tabbing.

A minor complication here is that currently Diva instances consider themselves active upon instantiation. Since that means that multiple instances can be active at once if and only if the user never clicks anything I think that's just a bug, but it has the consequence that initially a Diva instance will accept keyboard input, assuming the user hasn't done anything. This change would break that.

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