debugger icon indicating copy to clipboard operation
debugger copied to clipboard

[Accessibility] Editor Tabs and Source Tabs should be accessible

Open yzen opened this issue 9 years ago • 24 comments

There are several improvements that can be done for the source tabs to make them awesome for accessibility:

  • [ ] Most Importantly both tab widgets (source and editor tabs) should be the same shared component component that would be styled/configured differently for a particular location.
  • [ ] Reachable by keyboard: tabs should be accessible with the keyboard, right now there's not way to focus on the tab (if there is, it is not visible)
  • [ ] Tabs should be navigatable via keyboard -- there's a blueprint for adding this functionality here; https://github.com/devtools-html/debugger.html/pull/5806
  • [ ] Styling for keyboard focus for tabs
  • [ ] Close tab and add new (+) should be real buttons (or with role button), alternative text and be keyboard accessible: tabbable, activatable and have focus styling
  • [x] source-tabs should semantically be tabs. Marco has a good article about this.

Editor Tabs

Screen Shot 2017-09-18 at 8.13.49 PM.png

Source Tabs

screen shot 2018-04-27 at 10 33 09

yzen avatar Sep 18 '17 17:09 yzen

Questions

tabs should be accessible with the keyboard

@garbee looked at our tabs before and found them difficult to make accessible given the HTML structure. Does it make sense to try and refactor the HTML or do some JS controls around where tab sound take you?

Styling for keyboard focus for tabs

Is there a good default for tab focus state? I wish editor tabs were focusable :P

jasonLaster avatar Sep 18 '17 23:09 jasonLaster

Styling would be handled the same as buttons in most cases. As that is essentially what tabs are at the end of it all.

The specific problem in carrying this out with tabs though, is the close trigger. Those should be nested within the tab node, and buttons can't be nested in buttons. That's not nice. One solution to this though is borrowing from the linked tutorial. Have the list items, with anchors for the triggers and the close buttons as a button beside the anchor in the markup. This would allow for the anchor to be properly accessible and stylable, while allowing a button node to handle the close trigger which is what makes the most sense there. Win-Win on both sides. All the triggers are fully accessible and easily stylable.

<ul> <!-- Because tabs are lists -->
  <li>
    <a href>app-view.js</a><button>close</button>
  <li>
    <a href>app.js</a><button>close</button>
</ul>
Example markup structure for accessible tabs without all of the accessibility specific attributes.

Garbee avatar Sep 20 '17 11:09 Garbee

should be keyboard navigable

  • left and right arrow should change the focused tab
  • space or enter should select a source
  • tab/shift tab should jump to the command bar or source tree

We'll listen for arrows and space bar events and set the ariaActiveDescendent state

--- a/src/components/Editor/Tabs.js
+++ b/src/components/Editor/Tabs.js
@@ -325,6 +325,17 @@ class SourceTabs extends PureComponent {
     );
   }

+  onKeyDown() {
+    if (arrow) {
+      return this.setState({ariaActiveDescendent: tabIndes})
+    }
+
+    if (spaceBar) {
+      const source = getSource(tabIndex)
+      this.props.selectSource(source);
+    }
+  }

Style the tabs

We'll style the tabs w/ ariaActiveDescendent. This strategy will let us higlight the "active" tab when the tab list is in focus.

   renderTabs() {
     const { sourceTabs } = this.props;
     if (!sourceTabs) {
@@ -332,7 +343,12 @@ class SourceTabs extends PureComponent {
     }

     return (
-      <div className="source-tabs" ref="sourceTabs">
+      <div
+        className="source-tabs"
+        ref="sourceTabs"
+        tabIndex="0"

        // wee'll need to figure out how to do this correctly. 
+        {/* ariaActiveDescendent="tab-1" */}
+      >
         {sourceTabs.map(this.renderSourceTab)}
       </div>
     );
@@ -404,6 +420,7 @@ class SourceTabs extends PureComponent {
       <div
         className={className}
         key={source.get("id")}
         // each tab now needs an id
+        id={`tab-1`}

jasonLaster avatar Sep 21 '17 21:09 jasonLaster

/claim

Our team will work on this as part of an assignment for CSC426. @carterehc @acheamponge @chauwaj

CJSt avatar Oct 10 '17 20:10 CJSt

Thanks for claiming the issue! :wave:

Here are some link for getting setup, contributing, and development tips. We're always happy to answer questions in slack! If you become busy, feel free to /unclaim it.

:fox_face: Debugger team!

claim avatar Oct 10 '17 20:10 claim

Add new button has been removed in another update, so there's not a need to look for that. We weren't able to convert the tabs into lists in order to get keyboard navigation to work properly. Also, this issue seems similar to issue #4070 where the close button is also needing keyboard navigation.

CJSt avatar Dec 05 '17 15:12 CJSt

/unclaim

CJSt avatar Dec 05 '17 15:12 CJSt

/unclaim

emmet0r avatar Dec 07 '17 21:12 emmet0r

@yzen @darkwing what would you like to do here?

jasonLaster avatar Mar 22 '18 21:03 jasonLaster

We'll need to do a larger review and make some decisions. Making the close button an actual button seems reasonably easy. We'll need to think about keyboard shortcuts and tabbing, however. I'm thinking CTRL+0, CTRO+1, etc. would work for selecting individual tabs. How we navigate from one to the next....that will take some thought.

darkwing avatar Mar 22 '18 22:03 darkwing

I drafted keyboard navigation in this pull request: https://github.com/devtools-html/debugger.html/pull/5806

I'd love for someone to drag it across the finish line!

darkwing avatar Apr 09 '18 23:04 darkwing

/claim

I'd love to work on that, but it might take a while as I'm on a tight schedule. If someone is willing to work on that as well and can finish it faster let me know.

Sekhmet avatar Apr 10 '18 00:04 Sekhmet

Thanks for claiming the issue! :wave:

!!! Please check your email and confirm the invitation

Here are some links for getting setup, contributing, and developing. We're always happy to answer questions in slack! If you become busy, feel free to /unclaim it.

:fox_face: Debugger team!

claim avatar Apr 10 '18 00:04 claim

/claim

Would love to work on it. Might take some time to set it up and understand the current code. But will try to finish as soon as I can.

rajatvijay avatar Apr 10 '18 02:04 rajatvijay

Thanks for claiming the issue! :wave:

!!! Please check your email and confirm the invitation

Here are some links for getting setup, contributing, and developing. We're always happy to answer questions in slack! If you become busy, feel free to /unclaim it.

:fox_face: Debugger team!

claim avatar Apr 10 '18 02:04 claim

/claim

Figured I'll take a shot at this, as I have experience implementing tabs per the WAI-ARIA authoring practices 1.1 for a React accessible component library.

Worst case I'll unclaim if it ends up being more than I can handle, and will at least report back with any findings.

ahuth avatar Jul 04 '18 05:07 ahuth

Thanks for claiming the issue! :wave:

Here are some links for getting setup, contributing, and developing. We're always happy to answer questions in slack! If you become busy, feel free to /unclaim it.

:fox_face: Debugger team!

claim avatar Jul 04 '18 05:07 claim

Hey @ahuth what are your thoughts on the editor tabs? feasible? We can also redo the UX to make it easier for accessibility

jasonLaster avatar Aug 03 '18 14:08 jasonLaster

The current UX is definitely feasible. The hard part I think will be that the implementation needs to be changed pretty significantly for them.

ahuth avatar Aug 03 '18 21:08 ahuth

got it

On Fri, Aug 3, 2018 at 5:41 PM Andrew [email protected] wrote:

The current UX is definitely feasible. The hard part I think will be that the implementation needs to be changed pretty significantly for them.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/devtools-html/debugger.html/issues/4075#issuecomment-410383641, or mute the thread https://github.com/notifications/unsubscribe-auth/AAPiYuj5hO4EA_72bA5XWvqCpvZFbZPRks5uNMOTgaJpZM4PbPbx .

jasonLaster avatar Aug 03 '18 23:08 jasonLaster