Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(carousel): Improve accessibility - FRONT-3657 #2566

Merged
merged 22 commits into from
Jun 21, 2022
Merged

Conversation

papegaill
Copy link
Contributor

@papegaill papegaill commented Jun 9, 2022

  • fix tab key flow + deactivate focus on hidden slides (inert + tabindex='-1' as a fallback)
  • add play & pause buttons instead of only a toggle autoplay button
  • pause carousel on mouseover
  • disable autoplay if focus is on a slide CTA
  • activate only touch events on the slides and remove mouse drag events to be able to select slide content
  • if only one slide, hide controls and don't initialize carousel
  • deactivate autoplay on mobile < 768
  • update carousel styles:
    • review position of the controls for each breakpoint,
      previous & next buttons are moved in the control bar for mobile format (JS)
    • controls hover, active and focus stats

todo:

  • testing for reflow with the ARC toolkit, the arrows of the carousel disappear

@github-actions
Copy link

github-actions bot commented Jun 9, 2022

Copy link
Contributor

@emeryro emeryro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not really sure that it wa what the accessibility expert had in mind when talking about "two buttons", but if that's validated by COMM...

@@ -7,7 +7,8 @@
- "sr_previous" (string) (default: 'Previous slides') screen reader label for previous button
- "sr_next" (string) (default: 'Next slides') screen reader label for next button
- "sr_navigation" (string) (default: 'Go to slide %d') screen reader label for navigation buttons
- "sr_autoplay" (string) (default: 'Carousel auto play') screen reader label for autoplay button
- "sr_play" (string) (default: 'Play carousel') screen reader label for the play button
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could add a backward compatibility check, to use the value of the previous "sr_autoplay" by default
similar to what was done here https://github.com/ec-europa/europa-component-library/blob/v3.4.0-dev/src/implementations/twig/components/content-item/content-item.html.twig#L42

#{map.get(theme.$spacing, 's')} - #{$_outline-width}
);
}
.ecl-carousel__autoplay {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so user no longer has the possibility to play/pause carousel on mobile? Is it on purpose?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They update the spec, so no autoPlay on mobile anymore 👍

}

.ecl-carousel__prev {
left: 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess that it should be inverted in the rtl css

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already done in RTL CSS resource

@@ -225,6 +264,37 @@ $_outline-width: null !default;

.ecl-carousel__prev,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these buttons should be hidden on print

);
}
.ecl-carousel__autoplay {
display: none;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the buttons don't disapear at the the same breakpoint as the mobile version, so there are some cases where you have the mobile display, but still have the button

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -31,14 +31,17 @@ export class Carousel {
constructor(
element,
{
toggleSelector = '.ecl-carousel__toggle',
playSelector = '.ecl-carousel__play',
pauseSelector = '.ecl-carousel__pause',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure why we use css class selector here instead of data attributes as on the other components, but that would require some quite big changes...
Probably for next major version of this component

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I wanted to lighten the markup in a way... but indeed we'll have to align this as other components

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants