amphtml icon indicating copy to clipboard operation
amphtml copied to clipboard

amp-carousel's arrows are keyboard inoperable (inaccessible)

Open stefany-newman opened this issue 6 years ago • 9 comments

What's the issue?

Arrows are not operable by keyboard (no effect on pressing Spacebar or Enter)

How do we reproduce the issue?

Just test any amp-carousel

What browsers are affected?

I guess all? I tested on Chrome and FireFox on Windows 10

So, to remedy the issue, I had to write custom JS code to make the arrows operable by a keyboard. I am not a good JS developer, so please don't laugh at my code and I welcome suggestions on how to make it better (it works tho!):


window.onkeydown = function(event){
   if(event.keyCode === 32 && document.activeElement.className == 'amp-carousel-button amp-carousel-button-next') {
  event.preventDefault();
  document.querySelector('.amp-carousel-button-next').click()
   }
   if(event.keyCode === 32 && document.activeElement.className == 'amp-carousel-button amp-carousel-button-prev') {
   event.preventDefault();
   document.querySelector('.amp-carousel-button-prev').click();
   }
   if(event.keyCode === 13 && document.activeElement.className == 'amp-carousel-button amp-carousel-button-prev') {
   event.preventDefault();
   document.querySelector('.amp-carousel-button-prev').click(); 
   }
   if(event.keyCode === 13 && document.activeElement.className == 'amp-carousel-button amp-carousel-button-next') {
   event.preventDefault();
  document.querySelector('.amp-carousel-button-next').click(); 
   }
   };

It's important for the interface to be keyboard operable, otherwise it violates WCAG SC 2.1.1

stefany-newman avatar Jan 17 '20 23:01 stefany-newman

amp-carousel-0.2.js appears to have broken Enter / Spacebar presses on the Next/Previous buttons. The keyboard interactions work in amp-carousel-0.1.js .

You can see this in the amp playground with this code:

<!doctype html>
<html ⚡>
<head>
  <meta charset="utf-8">
  <title>My AMP Page</title>
  <link rel="canonical" href="self.html" />
  <meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
  <style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript>
  <script async src="https://cdn.ampproject.org/v0.js"></script>
  <script async custom-element="amp-carousel" src="https://cdn.ampproject.org/v0/amp-carousel-0.2.js"></script>
  <style amp-custom>
    h1 {
      margin: 1rem;
    }
  </style>
</head>
<body>
  <h1>Hello AMPHTML World!</h1>
    <amp-carousel height="300"
  layout="fixed-height"
  type="carousel">
  <amp-img src="/static/samples/img/image1.jpg"
    width="400"
    height="300"
    alt="a sample image"></amp-img>
  <amp-img src="/static/samples/img/image2.jpg"
    width="400"
    height="300"
    alt="another sample image"></amp-img>
  <amp-img src="/static/samples/img/image3.jpg"
    width="400"
    height="300"
    alt="and another sample image"></amp-img>
</amp-carousel>
    
</body>
</html>

Switching the amp-carouse version to 0.1 brings the keyboard interactions back.

Also, the Amp Carousel documentation uses version 0.1, which is why the examples in the docs work: https://amp.dev/documentation/examples/components/amp-carousel/?format=websites

jeryj avatar May 12 '20 14:05 jeryj

Is there any update to this issue? This is flagging as an issue for accessibility checks using axe.

rickbairstow avatar Aug 10 '20 14:08 rickbairstow

Please update progress. This issue is an Accessibility blocker for us at the moment.

Cheers

tryant4d avatar Sep 29 '20 19:09 tryant4d

The UI Working Group is planning the next Fixit on the week of October 19th. Our plan is to address during this time.

kristoferbaxter avatar Sep 29 '20 19:09 kristoferbaxter

Kind of disappointed to see that the issue hasn't been fixed almost a year later.

stefany-newman avatar Dec 22 '20 02:12 stefany-newman

This is crazy that this hasn't been fixed yet. People get sued for these types of issues. Will look into forwarding all legal fees to google. Claim they want to be an inclusive company but won't fix shit that excludes. Probably wouldn't take 15 minutes to fix on their end.

kahalabrands avatar Dec 09 '21 23:12 kahalabrands

@kahalabrands: this is an open source project. Anyone is free to open a pull request to fix this issue. I do agree that the carousel should be keyboard accessible.

After some local testing, I was able to navigate with the keyboard on carousel 0.1, but 0.2 is broken. Fixing in https://github.com/ampproject/amphtml/pull/37178

samouri avatar Dec 10 '21 17:12 samouri

You may also want to check the issue with the slides being read regardless of if they are visible. Using chrome vox. That’s another ADA issue.

From: Jake Fried @.> Date: Friday, December 10, 2021 at 10:24 AM To: ampproject/amphtml @.> Cc: Bradley Myers @.>, Mention @.> Subject: Re: [ampproject/amphtml] amp-carousel's arrows are keyboard inoperable (inaccessible) (#26396)

@kahalabrandshttps://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fkahalabrands&data=04%7C01%7Cbwmyers%40kahalamgmt.com%7Cda6e9f628eb64f7b003d08d9bc01e823%7C03c27f5867ea4ae1b8e21ed252c3ef54%7C0%7C0%7C637747538655673085%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=BkOoJ6%2BCTl35Ps7xWsrNjHhdw5CiBIBV610ReMRdjVU%3D&reserved=0: this is an open source project. Anyone is free to open a pull request to fix this issue. I do agree that the carousel should be keyboard accessible.

After some local testing, I was able to navigate with the keyboard on carousel 0.1, but 0.2 is broken. Fixing in #37178https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fampproject%2Famphtml%2Fpull%2F37178&data=04%7C01%7Cbwmyers%40kahalamgmt.com%7Cda6e9f628eb64f7b003d08d9bc01e823%7C03c27f5867ea4ae1b8e21ed252c3ef54%7C0%7C0%7C637747538655673085%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=9suwkcE3N7VEZPG%2BBZw%2F3gOheCF7M7vm1JzW5CpCqKE%3D&reserved=0

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fampproject%2Famphtml%2Fissues%2F26396%23issuecomment-991155317&data=04%7C01%7Cbwmyers%40kahalamgmt.com%7Cda6e9f628eb64f7b003d08d9bc01e823%7C03c27f5867ea4ae1b8e21ed252c3ef54%7C0%7C0%7C637747538655673085%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=rWGfs9OyfrahzdEoEAGVQ6Cbs9YOKFtDemkfbpO0iig%3D&reserved=0, or unsubscribehttps://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAELSTQKMF5UAAZP44CJ2I7TUQIZULANCNFSM4KIPQRYA&data=04%7C01%7Cbwmyers%40kahalamgmt.com%7Cda6e9f628eb64f7b003d08d9bc01e823%7C03c27f5867ea4ae1b8e21ed252c3ef54%7C0%7C0%7C637747538655673085%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=c4y%2B1dK1ueskIk2nHJr0ef2Dv8QWLr3ZdasT53%2FIavc%3D&reserved=0. Triage notifications on the go with GitHub Mobile for iOShttps://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fapps.apple.com%2Fapp%2Fapple-store%2Fid1477376905%3Fct%3Dnotification-email%26mt%3D8%26pt%3D524675&data=04%7C01%7Cbwmyers%40kahalamgmt.com%7Cda6e9f628eb64f7b003d08d9bc01e823%7C03c27f5867ea4ae1b8e21ed252c3ef54%7C0%7C0%7C637747538655673085%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=5XoYnvfZcmx2pp4J9nOQZQLZmb4ofLdENWXdIJnprF4%3D&reserved=0 or Androidhttps://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fplay.google.com%2Fstore%2Fapps%2Fdetails%3Fid%3Dcom.github.android%26referrer%3Dutm_campaign%253Dnotification-email%2526utm_medium%253Demail%2526utm_source%253Dgithub&data=04%7C01%7Cbwmyers%40kahalamgmt.com%7Cda6e9f628eb64f7b003d08d9bc01e823%7C03c27f5867ea4ae1b8e21ed252c3ef54%7C0%7C0%7C637747538655673085%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=29lXrjurQaLP6Dj0Isv8xUQVbYyHQpK8SXF6F8FIBQ4%3D&reserved=0.

kahalabrands avatar Dec 10 '21 22:12 kahalabrands

@kahalabrands: can you submit a separate GH Issue for that with a description for how to reproduce?

samouri avatar Dec 13 '21 16:12 samouri