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

Only bind keypress events when the board has focus #132

Open
pconerly opened this issue Nov 1, 2015 · 2 comments
Open

Only bind keypress events when the board has focus #132

pconerly opened this issue Nov 1, 2015 · 2 comments
Milestone

Comments

@pconerly
Copy link
Contributor

pconerly commented Nov 1, 2015

Re: https://github.com/Kashomon/glift/blob/0625a4e33d6e5472691a980b05641151589adc48/src/widgets/options/base_options.js#L461-L466

This currently binds keypress events to document.body, so it's not unlikely this could conflict with other applications' keybindings.

We should fix this so that glift can be happily embedded with more involved applications. It does have a potential of causing problems for users if they don't give focus to glift.

On way to solve that design problem would be to have a keyboard icon that is solid when glift has focus, and greyed-out when it doesn't ?

Don't write any code yet, I may have a PR for you.

@artasparks artasparks added this to the Glift 1.1 milestone Mar 20, 2016
@artasparks
Copy link
Owner

I have been playing around with this for a while.

So to summarize from the PR, the method is to use tabindex=0 and focusfor an individual div. If I click away from the box, the div becomes unfocused and key events stop working. This is probably fine although slightly different than the current behavior, but I worry about integration in other pages. I noticed when I tried this out on www.gliftgo.com that the div gets an annoying border around it, although it looks like this can be solved with outline: none;

The other solution is to use contenteditable, but that's obviously not ideal.

References:

@artasparks
Copy link
Owner

Even if I add this, I'll add the keyboard in a separate commit or as part of the settings icon

artasparks added a commit that referenced this issue Apr 14, 2016
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

2 participants