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

Cubism not bubbling up left/right arrow key events? #16

Open
faulkner opened this issue Jun 24, 2012 · 3 comments
Open

Cubism not bubbling up left/right arrow key events? #16

faulkner opened this issue Jun 24, 2012 · 3 comments

Comments

@faulkner
Copy link

I'd like to use Cubism on a page that also happens to have input fields, but it seems to be blocking the left/right keydowns events from bubbling up.

I have a hacked up version of the http://square.github.com/cubism/ landing page at http://bl.ocks.org/2983814 with an input field added to recreate the issue.

Not sure if this is a bug or if I'm just doing something wrong.

@mbostock
Copy link
Collaborator

The context listens for arrow key events to control the focused time. See context.js.

I think if you want to fix this, you'll either need a way to disable keyboard controls on the context, or you'll need to put the cubism charts inside a focusable element (e.g., <div tabIndex="1">) and put the input fields outside the focusable element. In the latter case, Cubism would also need to detect that it's inside a focusable element and put the key listeners there rather than on the window. I implemented something similar to Polymaps a few years ago; see focusableParent.

@jarben
Copy link

jarben commented Sep 5, 2013

This would disable the key handler:
d3.select(window).on("keydown.context-1", null);

@hellige
Copy link

hellige commented Jul 24, 2015

Wouldn't it be pretty easy to make the key binding optional in a given context? There are lots of other options, seems like one more wouldn't be a big deal. Grabbing left/right for the whole window seems like something a lot of people might not want...

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

4 participants