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

DRAFT: carousel revamp #4635

Draft
wants to merge 21 commits into
base: main
Choose a base branch
from
Draft

DRAFT: carousel revamp #4635

wants to merge 21 commits into from

Conversation

Fercas123
Copy link
Contributor

No description provided.

Copy link

vercel bot commented Jan 31, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
saltdesignsystem ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 27, 2025 11:36am

Copy link

changeset-bot bot commented Jan 31, 2025

⚠️ No Changeset found

Latest commit: f84022c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

*/
id?: string;
bordered?: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

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

Styles might need to be checked, currently this shifts the alignment

Copy link
Contributor Author

Choose a reason for hiding this comment

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

that's intentional, but the prop name might not give it very clearly... I will check this with @ivan-calderon but there is a Hero (transparent) version and a...norther(bordered) one hahaha will check the naming

const ControlsLabel = () => (
<Text as="span">
<strong>
{/* TODO: check w dev, this will need changing or a formatter*/}
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably fine for now, we should align with Pagination

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you mean secondary & no bold? pagination seem to be forcing the of in, no formatter... should there be one to allow users to format the info?

@Fercas123
Copy link
Contributor Author

/release-pr

Copy link
Contributor

@jake-costa jake-costa left a comment

Choose a reason for hiding this comment

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

A few additional items:

  • When the previous or next button is pressed the position should also be conveyed to screen reader users (e.g. "slide label" 2 of 5)

  • When previous button is pressed moving the carousel back to slide 1 (if we are not allowing wrapping) and the button becomes disabled, focus should be placed on the next button. Similarly when pressing next button for the last slide, when the next button is disabled, focus should be placed on the previous button.

  • Just checking, for mobile view/small viewport did we want to leave the previous/next buttons at the top?

<Carousel
{...args}
visibleSlides={{ sm: 1, md: 2 }}
aria-label="Categorical backgrounds carousel"
Copy link
Contributor

Choose a reason for hiding this comment

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

@Fercas123 it is likely just because it is an example but I recommend removing "carousel" from the aria label as aria-roledescription already indicates it is a carousel so it is repeated twice.

{Media && <div className={withBaseName("mediaContainer")}>{Media}</div>}
<div className={withBaseName("fixedContainer")} ref={buttonBarRef}>
<div
role="group"
Copy link
Contributor

Choose a reason for hiding this comment

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

Each slide container with role group should also have aria-roledescription set to "slide".

In addition each slide should have an accessible name:

  • If a slide has a visible label, its accessible label is provided by the property aria-labelledby on the slide container set to the ID of the element containing the visible label (e.g. the h3).

  • Otherwise, an accessible label is provided by the property aria-label set on the slide container.

  • If unique names that identify the slide content are not available, a number and set size can serve as a meaningful alternative, e.g., "3 of 10". Note: Normally, including set position and size information in an accessible name is not appropriate. An exception is helpful in this implementation because group elements do not support aria-setsize or aria-posinset.

  • Note that since the aria-roledescription is set to "slide", the label should not contain the word "slide."

ref={useForkRef(ref, containerRef)}
className={withBaseName()}
aria-live="polite"
role="region"
Copy link
Contributor

Choose a reason for hiding this comment

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

We only need 1 role="region", it looks like we have one on the carousel container that has aria-roledescription="carousel" which includes all the elements. We can remove this one.

<div
ref={useForkRef(ref, containerRef)}
className={withBaseName()}
aria-live="polite"
Copy link
Contributor

Choose a reason for hiding this comment

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

While it is optional, I recommend adding aria-atomic set to false
Reference: APG carousel

className={withBaseName()}
aria-live="polite"
role="region"
tabIndex={0}
Copy link
Contributor

Choose a reason for hiding this comment

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

If we want to make the slide focusable, can we move the tabindex="0" to the slide container has role group.

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

Successfully merging this pull request may close these issues.

3 participants