-
-
Notifications
You must be signed in to change notification settings - Fork 78.9k
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
Carousel - is it possible to turn off keyboard navigation? #14468
Comments
I suppose we could add a boolean |
I realize it could hurt accessibility - but I would think that depends on how the carousel is being used. In my case, I have input controls in the item panes, and when I try to edit those inputs and navigate through the input via the arrow keys, I am running into major problems. ....After further thought, my particular application does not benefit from the arrow navigation and it is confusing for it to exhibit this behavior. I don't have to be focused on an input for the arrow keys to actively navigate, so not sure how I am going to resolve this issue. Any hints or suggestions are welcome. I wish I could key into what caused the slid or slid event and decide any further action from there. |
My solution to the issue was to capture the keydown event on the input control. Still seems odd how the carousel covers up this behavior, but this is an easy enough workaround. I also still have that arrow key navigation/accessibility goodness.
|
To completely disable keyboard navigation you could do this: $('#myCarousel').off('keydown.bs.carousel'); But that only works if you initialize the carousel yourself and do not rely on the data-api, because it waits for the page to load until the carousel is initialized and therefore you'd need to wrap it in a |
Also adds unit tests for keyboard events. Fixes #14468.
Also adds unit tests for keyboard events. Fixes #14468.
Also adds unit tests for keyboard events. Fixes #14468.
you have several options:
It seems like a pretty rare case that you would want to turn accessibility off like this, so I'm not thrilled about adding an option for it |
It might be a rare case - but I didn't think it was that odd to re-purpose a standard carousel control into a content container that was controlled by the navigational elements. |
At any rate, the new option to disable the carousel's handling of keyboard events was approved: #14590. |
Also adds unit tests for keyboard events. Fixes twbs#14468.
Allright, using data attr or via js, it works, but there is an strange issue in my case.
By the way my pop modal is outside of the the carousel. It is just triggered from one of the carousel slide. |
I am finding that I cannot turn off keyboard navigation within the carousel. The carousel panes are sliding/changing when I use the arrow keys and I can't find a way to turn this behavior off.
I can hook into .on('keydown.bs.carousel' event, but unfortunately, this fires after the carousel has executed both 'slide; and 'slid' events.
Is there another event I can hook into to determine how the carousel is being advanced?
The text was updated successfully, but these errors were encountered: