debugger icon indicating copy to clipboard operation
debugger copied to clipboard

[Accessibility] accordion accessibility

Open yzen opened this issue 9 years ago • 33 comments

This issue tracks the work to make the accordion accessible. A PR can do one or several items in the checklist:

  • [x] Visually (CSS focus styling) there is no way to focus on the accordion headers and reload button
  • [x] Need to be able to navigate to headers with keyboard
  • [ ] Need to be able to collapse expand headers with keyboard
  • [x] Headers/Panels should at least have list/listitem semantics including expanded and collapsed states.
  • [ ] Headers listitem should have expanded and collapsed states exposed.
  • [ ] When reaching a tree widget inside an accordion section focus should remain on the container for efficiency. The tree should handle keyboard using arrow keys (similar to source list tree widget).
  • [ ] Breakpoint related check boxes must be properly accessible. Text label (or code line that serves as one) must be set as the formal label for the checkbox.

Screenshot

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

yzen avatar Sep 18 '17 19:09 yzen

Style the focus state:

This is a patch for styling the focus state. I'm not sure what style we should apply.

diff --git a/src/components/shared/Accordion.css b/src/components/shared/Accordion.css
index 0cd96de..3035a11 100644
--- a/src/components/shared/Accordion.css
+++ b/src/components/shared/Accordion.css
@@ -30,6 +30,10 @@
   cursor: default;
 }

+.accordion ._header:focus {
+  background-color: yellow; /* not sure what color makes sense */
+}
+
 .accordion ._header:hover {
   background-color: var(--theme-toolbar-background-hover);
 }

Need to be able to navigate to headers with keyboard

Do we need to do something to make the header focusable?

Need to be able to collapse expand headers with keyboard

diff --git a/src/components/shared/Accordion.js b/src/components/shared/Accordion.js
index 9f45ce2..fb69473 100644
--- a/src/components/shared/Accordion.js
+++ b/src/components/shared/Accordion.js
@@ -35,6 +35,7 @@ class Accordion extends Component {

     const self: any = this;
     self.renderContainer = this.renderContainer.bind(this);
+    self.onKeyDown = this.onKeyDown.bind(this);
   }

   componentWillReceiveProps(nextProps: Props) {
@@ -93,9 +94,15 @@ class Accordion extends Component {
     );
   }

+  // our goal is to toggle the header with spacebar and enter
+  // i'm not sure if this event listener will work when the focus is on the header
+  onKeyDown(e) {
+    // will this recieve the event?
+  }
+
   render() {
     return (
-      <div className="accordion">
+      <div className="accordion" onKeyDown={this.onKeyDown}>
         {this.props.items.map(this.renderContainer)}
       </div>
     );

Other Questions

When reaching a tree widget inside an accordion section focus should remain on the container for efficiency.

what do you mean by container?

Headers/Panels should at least have list/listitem semantics?

Is this defined somewhere?

jasonLaster avatar Sep 18 '17 23:09 jasonLaster

Need to be able to navigate to headers with keyboard

Header elements should be tabbable (have tabindex="0" attribute). This way, within the accordion, tabbing will jump between headers, optional controls inside headers (checkboxes, etc) and tree elements within the accordion list item (they will be keyboard accessible when the tree component is updated).

yzen avatar Sep 25 '17 13:09 yzen

what do you mean by container?

By container I mean the element that has a .tree class (e.g. element containing the tree component). This will be solved with tree component update.

yzen avatar Sep 25 '17 13:09 yzen

Headers/Panels should at least have list/listitem semantics? Is this defined somewhere?

With some list specific styling taken care of (removed) the following changes will make accordion more semantically reach:

--- a/src/components/shared/Accordion.js
+++ b/src/components/shared/Accordion.js
@@ -73,14 +73,14 @@ class Accordion extends Component {
       .replace(/\s/g, "-")}-pane`;
 
     return (
-      <div className={containerClassName} key={i}>
-        <div className="_header" onClick={() => this.handleHeaderClick(i)}>
+      <li className={containerClassName} key={i}>
+        <h2 className="_header" onClick={() => this.handleHeaderClick(i)}>
           <Svg name="arrow" className={opened[i] ? "expanded" : ""} />
           {item.header}
           {item.buttons ? (
             <div className="header-buttons">{item.buttons}</div>
           ) : null}
-        </div>
+        </h2>
         {created[i] || opened[i] ? (
           <div
             className="_content"
@@ -89,15 +89,15 @@ class Accordion extends Component {
             {createElement(item.component, item.componentProps || {})}
           </div>
         ) : null}
-      </div>
+      </li>
     );
   }
 
   render() {
     return (
-      <div className="accordion">
+      <ul className="accordion">
         {this.props.items.map(this.renderContainer)}
-      </div>
+      </ul>
     );
   }
 }

Note <H2> is used here only because I assumed it's the logical nested header level, it might actually be something else.

yzen avatar Sep 25 '17 13:09 yzen

Working on bug " Need to be able to collapse expand headers with keyboard" .claim on that specific bug. Did not want to "/claim" for the whole thing. CS 490 WNE

CrisOrellana avatar Oct 13 '17 02:10 CrisOrellana

/claim

Hey @CrisOrellana, I'll claim it so it's yours, but you can start with the easy stuff and we'll go from there. Small PRs are always better.

jasonLaster avatar Oct 13 '17 03:10 jasonLaster

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 13 '17 03:10 claim

We have learned a lot while working on this enhancement as well as how long it takes just to complete something that doesn't even seem like a lot of work when it actually is. Although we have not completed the enhancement on time due to the semester ending, we figured out some things that could very well help someone who does have the time to do so! One thing we have figured out is how the accordion works in relation to accessibility. We figured out that an event listener may be needed in order to assign a specific hotkey to collapse and expand the headers along with messing with the accordion. If there are any questions please feel free to message me!

/unclaim

CrisOrellana avatar Dec 11 '17 04:12 CrisOrellana

/claim

I'll have a group of students taking up this issue this week! Will tag them shortly.

emmet0r avatar Mar 13 '18 02:03 emmet0r

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 Mar 13 '18 02:03 claim

@paesh1997, @denigrise, and I are in @emmet0r class and will be trying to tackle the second check box "Need to be able to navigate to headers with keyboard"

ghost avatar Mar 22 '18 18:03 ghost

@jawyoonis and @phuyalb16 are in @emmet0r class and we are working on checkbox 4 (header/panels and list semantics).

moses-gbondo avatar Mar 27 '18 18:03 moses-gbondo

Hello all, We are working on - Headers/Panels should at least have list/listitem semantics including expanded and collapsed states. We have added li and this is what we came up with. The image now has li in bullet form. Please see image below. image

We know that we need to fix the css/formatting so that it looks the same way that it used to. Do we also need to add ARIA roles list and listitem?

image

@yzen @jasonLaster @emmet0r

please18 avatar Mar 29 '18 18:03 please18

@jasonLaster @yzen After inserting tabindex="0" into the <div className="_header" and the <div className="header-buttons" in the /src/components/shared/Accordion.js file, we noticed that we were able to tab through the headers in the order specified in the image attached. We could only do this after pressing Crtl Shift F to search in files, otherwise it would tab to the collapse pane buttons and then the user could no longer use tab to navigate. We do not know what happens at points 3 and 7, and it seems to stop after point 15. What order or behavior that we should be striving for? Any additional information would be helpful and appreciated. selection_001

ghost avatar Mar 29 '18 18:03 ghost

Hello @chan750!

Thank you for your help! My best advice on finding out what's being focused upon between 3 and 7 is using document.activeElement (https://developer.mozilla.org/en-US/docs/Web/API/DocumentOrShadowRoot/activeElement) to see what element, if any, is being focused.

As for desired order, I don't know that I have a "correct" answer. Logically, I think a "left to right" approach makes sense, i.e. the SourcesTree on the left / Outline panes, then into the document, then into the secondary pane. @yzen Could you provide a bit more insight as for tabIndex?

David

darkwing avatar Mar 29 '18 18:03 darkwing

@paesh1997 @denigrise and I were able to make some improvements to the tab order, but we will have to stop here. Our semester is coming to a close and we will no longer be able to continue working on the second check box "Need to be able to navigate to headers with keyboard." Running setInterval(function() { console.log(document.activeElement); }, 3000); in the web console will allow the user to see which elements are being focused. We noticed that <div class="CodeMirror cm-s-mozilla" tabindex="0"> and < html class="theme-light html" dir="ltr"> are being focused when they should not be. So that is where we recommend starting.

ghost avatar Apr 19 '18 17:04 ghost

Hello all, My teammates (@jawyoonis and @phuyalb16) and I were working on check box #4 - Headers/Panels should at least have list/listitem semantics including expanded and collapsed states. Our PR was successfully merged and therefore it is time to /unclaim the issue. Thanks for your help @jasonLaster @darkwing @yzen

please18 avatar Apr 24 '18 17:04 please18

Reading through my team and I, in CS435 WOU, see that there are parts of this bug claimed from other classes. We would like to contribute to this as well would it be not be okay to claim "Need to be able to collapse expand headers with keyboard"? @emmet0r or would that interfere with any of your groups?

nastark519 avatar Apr 30 '18 18:04 nastark519

Go for it

jasonLaster avatar Apr 30 '18 18:04 jasonLaster

+1

The WNE students are no longer working on these issues.

On 04/30/2018 02:44 PM, Jason Laster wrote:

Go for it

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/devtools-html/debugger.html/issues/4080#issuecomment-385491516, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AAgjdDULueAswIr_DJCqKJNoNwATodbyks5tt1uVgaJpZM4PbZKw.

HeidiEllis avatar May 01 '18 13:05 HeidiEllis