Basically, if you use the keyboard to select a category tab in the "Add content" modal, then keyboard focus will be lost. This makes using this modal very difficult for people who use the web browser with an assistive technology of some kind.
I propose that keyboard focus is automatically given to the selected category tab the first element in the category after the new content is loaded via AJAX. I'll post a patch for this in a moment.
If you're using Chrome, it depends on this issue as well, since the commands buttons aren't currently focusable under Chrome: #2356449: Content type buttons not focusable under Chrome (accessibility problem)
(NOTE: This is part of an effort to make using Panels more accessible in Panopoly, and grew out of testing on this CTools issue: #2280853: Keyboard trap when using ctools modal)
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | panels-focus-add-content-tab-2390803-13.patch | 1.47 KB | dsnopek |
| #8 | Selection_008.png | 30.27 KB | dsnopek |
Comments
Comment #1
dsnopekPatch is attached! Please let me know what you think.
Comment #2
cboyden commentedTested on Mac OSX 10.9.5 with Chrome 39.0.2171.95, Firefox 34.0.5 and Safari 7.1. It's working as expected.
Comment #3
mgiffordI don't use Panels often. Would this be here admin/structure/pages/add/page-example/content
Comment #4
cboyden commentedYes, if you're creating a new page. Once the page is created, you can get back to it at admin/structure/pages/nojs/operation/page-page_manager_page/handlers/page_page_manager_page_panel_context/content
To test:
Comment #5
dsnopekSome testing with a screenreader was done (not by me - I'm not that cool) and the suggestion was made that focus should REALLY be on the first element in the category that just got loaded.
Here is an updated patch that does that instead! If you're using Chrome, it depends on this issue as well, since the commands buttons aren't currently focusable under Chrome: #2356449: Content type buttons not focusable under Chrome (accessibility problem)
Comment #6
dsnopekComment #7
cboyden commentedThis is working when using the IPE on Firefox, Chrome, and Safari (Mac). Unfortunately it's not working when I run this from the Page Manager page editing interface. Keyboard focus is lost entirely (Firefox) or outside the modal (Chrome, Safari). In Chrome and Safari, I can tab in and out of the modal, backward and forward.
Comment #8
dsnopek@cboyden: Thanks for the testing! So, just to be clear to anyone following along, your steps also involve using the patch from #2280853: Keyboard trap when using ctools modal. This issue is only about having focus start on a particular element when the dialog opens - which is what I'd like to focus on here. The tabbing stuff we can continue on #2280853.
I'm testing with a vanilla Drupal 7.34 site, with Panels 3.x (cd0ded6) + this patch, and CTools 1.x (fb6c216) + no patches. Following a sub-set of your steps (#1-9), everything works fine for me on Chrome 40.0.2214.91 on Linux, ie. on step #9 I see the first item focused. Here's a screenshot right after activating a category link:
Under Firefox 34.0 on Linux, the same element gets focused (I can tell by the URL shown at the bottom of the window), however it isn't visually marked in anyway. :-/ Unfortunately, I don't have Safari to test.
But here is a new patch that adds some CSS to put a box around focused elements. Does this fix the issues you were seeing (only with regard to this patch)?
Comment #10
cboyden commentedIt's possible that the errors in this and the linked issue #2280853: Keyboard trap when using ctools modal are caused by the same thing: jQuery errors. See my latest comment in that issue for stack traces of the error I see when tabbing within the modal.
This is happening on Mac, Firefox 35.0.1 and Chrome 40.0.2214.94. I tested with the absolute latest Panels, Panelizer, and ctools, plus the latest patch in this issue and the linked issue.
The error I see when activating a category link is:
Error: Syntax error, unrecognized expression: focusableSince the exact same code is working fine in the IPE, I don't think "focusable" or "tabbable" pseudo-selectors are actually the problem.
Stack trace from Firebug:
Comment #11
cboyden commentedThis may be it: When the core Overlay is disabled, I get the jQuery error. When it's enabled, I don't, and the code works as intended. @dsnopek can you try disabling Overlay on your test site and see what you get?
Comment #12
dsnopekGreat catch! The key is that the
:focusableselector comes from jQuery UI core.js (which overlay loads), so we need to make sure that is loaded in this dialog as well. It's a super small file (basically just defining the selectors and some other super small utility things:https://github.com/jquery/jquery-ui/blob/9d0f44fd7b16a66de1d9b0d8c5e4ab9...
So, it really shouldn't slow anything down by being loaded -- and it's necessary for the accessibily changes to CTools over in #2280853: Keyboard trap when using ctools modal and accessibility is important.
Comment #13
dsnopekOk, here is a new patch that should fix this! We'll probably fix in CTools too in #2280853: Keyboard trap when using ctools modal, but I think it's important that Panels load this library as well in the case that someone updates Panels without also updating CTools.
Comment #14
cboyden commentedExcellent! The Panels part of this issue looks good to me. There was an IE 8 problem in #2280853: Keyboard trap when using ctools modal, but I did a quick fix and posted a new patch over there.
Comment #15
dsnopekWoohoo! Thanks. :-)
Comment #16
japerryAdded to my list of stuff to review for 1.7 (maybe 1.8)?
Comment #17
damienmckennaComment #19
japerryThanks for everyone's work on this! Committed.