E-mail List Archives
Re: keyboard navigable photo gallery
From: Bryan Garaventa
Date: Jan 11, 2016 10:57PM
- Next message: _mallory: "Re: keyboard navigable photo gallery"
- Previous message: isabel brison: "Re: keyboard navigable photo gallery"
- Next message in Thread: _mallory: "Re: keyboard navigable photo gallery"
- Previous message in Thread: isabel brison: "Re: keyboard navigable photo gallery"
- View all messages in this Thread
Basically, when a natively active element that has focus is disabled, it is no longer focusable in the browser, so some browsers may allow focus to move to the next focusable element when tab is pressed, and others will simply start over by setting focus to the first focusable element on the page instead. After focus is lost in this way, it has to be manually reset if you want to maintain the same tab order using the JavaScript focus() method.
So, if you add one line of code to your script after the element.disabled statement, that uses element.focus() to set focus to the next intuitive focusable element, that should do the trick. E.G If you keep pressing Enter while focus is on a Previous button, which then becomes disabled when it can't go back any further, focus is then automatically moved to the Next button. Hopefully that example makes sense.
Best wishes,
Bryan
- Next message: _mallory: "Re: keyboard navigable photo gallery"
- Previous message: isabel brison: "Re: keyboard navigable photo gallery"
- Next message in Thread: _mallory: "Re: keyboard navigable photo gallery"
- Previous message in Thread: isabel brison: "Re: keyboard navigable photo gallery"
- View all messages in this Thread