This was quite the search before I figured out why I seemingly randomly couldn't tab through any forms.
But, when you enable "edit mode" on a frontend page so all contextual links are visible, and then you go to the backend (where that "edit mode" button isn't even visible and as far as I can remember contextual links aren't even used) a tabbingManager constraints is still being applied. Resulting in essentially no fields being tabbable.
This happens on every form. From node/add to /admin/config/system/site-information. If "edit mode" is enabled, and you check console log with devel_a11y you will see the following constraint active:
TabbingManager: tabbing contraint activated, level 0, 0 tabbable elements, 48 disabled elements.
Which is a constraint that restricts tabbing to only contextual links, of which there are none.
I don't know how to fix it though, Drupal's javascript isn't my forte. I know the constraint is set by AuralView.js (core/modules/contextual/js/toolbar/views/AuralView.es6.js) because the edit mode is still technically enabled, so I'd suggest automatically disabling edit mode when viewing the admin pages or skipping this part when viewing admin pages.
// Create a new tabbing context when edit mode is enabled.
if (!this.model.get('isViewing')) {
tabbingContext = Drupal.tabbingManager.constrain($('.contextual-toolbar-tab, .contextual'));
this.model.set('tabbingContext', tabbingContext);
this.announceTabbingConstraint();
this.announcedOnce = true;
}
This may need escalation to Major, as this essentially breaks the entire backend for the people it was meant to help in the first place.
Comment | File | Size | Author |
---|---|---|---|
#38 | 2991686-38.patch | 3.13 KB | Gauravvvv |
#30 | 2991686-30.patch | 2.41 KB | smustgrave |
| |||
#30 | interdiff-27-30.txt | 772 bytes | smustgrave |
#24 | 2991686-24-tests-only.patch | 1.68 KB | smustgrave |
Comments
Comment #2
Grayle CreditAttribution: Grayle as a volunteer commentedComment #3
mgiffordComment #10
larowlanPerhaps we deactivate it if there are no items to tab to?
Comment #13
smustgrave CreditAttribution: smustgrave at Mobomo commentedis it desired to stay enabled? Maybe it defaults to off when page is loaded. If it should stay enabled shouldn't that be a setting somewhere?
Comment #14
smustgrave CreditAttribution: smustgrave at Mobomo commentedSomething like this?
Comment #15
larowlanCouple of unintended changes in that file
Comment #16
smustgrave CreditAttribution: smustgrave at Mobomo commentedSorry! But what do you think about turning that one feature off?
Comment #17
larowlanIt's there for accessibility, we can't turn it off unconditionally, but maybe we can turn it off if there's no contextual links on the page
Comment #18
smustgrave CreditAttribution: smustgrave at Mobomo commentedIs it still an accessibility issue if there are contextual links and tabable components on the page?
Comment #19
larowlanThe intent of the edit button is to trap tabbing to only contextual links when its enabled.
Comment #20
smustgrave CreditAttribution: smustgrave at Mobomo commentedGotcha. So the javascript seems to run before the page load. Any suggestion on how to check the contents?
Comment #21
smustgrave CreditAttribution: smustgrave at Mobomo commentedThoughts?
Comment #22
smustgrave CreditAttribution: smustgrave at Mobomo commentedThis should hopefully do it.
Comment #24
smustgrave CreditAttribution: smustgrave at Mobomo commentedComment #26
larowlanI think we still need to refine this.
Steps to reproduce:
* Visit a page with contextual links, toggle into edit mode
* Visit a page without contextual links, because it was previously set in your local storage, edit mode remains on and tabbing is broken.
So in other words, I think we need the lack of contextual region items to trump the local storage option.
We also need a negative assert here that there are no contextual links/regions on this page.
Comment #27
smustgrave CreditAttribution: smustgrave at Mobomo commentedLike this?
Comment #28
mgiffordAdding WCAG 2.1.1 tag
Comment #29
larowlanI found this hard to read - I think we can do this
document.querySelector('body .contextual-region') === null || localStorage.getItem('Drupal.contextualToolbar.isViewing') !== 'false'
and ditch jQuery too
Didn't manually test, but will keep on my list to do so (keeping at NR)
Comment #30
smustgrave CreditAttribution: smustgrave at Mobomo commentedMade the change in #29 and quick testing shows it still works.
Enabled contextual links on an Article page
Went to /admin/content, where there are no contextual links and could tab normally.
Comment #31
larowlanManually tested this and it works as designed.
Before: tabbing doesn't work
After: tabbing works
Thanks for accommodation lots of rounds of feedback here @smustgrave
Comment #33
smustgrave CreditAttribution: smustgrave at Mobomo commentedRandom failure
Comment #35
bnjmnmWho knows how often this tripped someone up? t seems like the kind of problem someone might attribute to their own user error when it's actually a fixable bug. Good fix and solid test coverage in the patch.
I committed to 10.1.x, and I'm checking to see if commit checks pass for 10.0.x to cherry-pick to account for any possible lint/formatting requirements.
Comment #37
bnjmnmCherry picked this to 10.0.x. This addresses a bug that could otherwise be quite frustrating, so backporting this to 9.5.x would be nice to do. This will need a 9.5.x specific patch as 9x requires .es6.js files. Setting issue status to "Patch (to be ported)" and the provider of the patch can switch back to RTBC or Needs Review (depending on their patch-porting confidence level)
Comment #38
Gauravvvv CreditAttribution: Gauravvvv at Axelerant for Drupal India Association commentedI have attached patch for 9.5.x. please review
Comment #39
smustgrave CreditAttribution: smustgrave at Mobomo commentedComment #41
smustgrave CreditAttribution: smustgrave at Mobomo commentedRandom failure
Comment #43
Anandhi Karnan CreditAttribution: Anandhi Karnan as a volunteer and at Material for Drupal India Association commentedFixed test failures, please review.
Comment #44
smustgrave CreditAttribution: smustgrave at Mobomo commentedSo even if it's a random failure we wouldn't solve it here. It would need to be it's own ticket.
Also the patch in #43 doesn't include the original patch so hiding that.
Comment #46
mgiffordComment #47
larowlan9.5 is now security only, so marking this as fixed and moving version to 10.0