Skip to content

Conversation

@TylerJDev
Copy link
Member

@TylerJDev TylerJDev commented Jun 11, 2024

Closes https://github.com/github/primer/issues/2501, https://github.com/github/primer/issues/3471

Changelog

Changed

  • Added aria-labelledby to ActionList.TrailingVisual

Rollout strategy

  • Patch release
  • Minor release
  • Major release; if selected, include a written rollout or migration plan
  • None; if selected, include a brief description as to why

Testing & Reviewing

Merge checklist

@changeset-bot
Copy link

changeset-bot bot commented Jun 11, 2024

🦋 Changeset detected

Latest commit: cf00630

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/react Patch

Not sure what this means? Click here to learn what changesets are.

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

@github-actions
Copy link
Contributor

github-actions bot commented Jun 11, 2024

size-limit report 📦

Path Size
packages/react/dist/browser.esm.js 95.85 KB (+0.1% 🔺)
packages/react/dist/browser.umd.js 96.11 KB (+0.05% 🔺)

@github-actions github-actions bot temporarily deployed to storybook-preview-4666 June 11, 2024 18:29 Inactive
@TylerJDev TylerJDev added the update snapshots 🤖 Command that updates VRT snapshots on the pull request label Jun 12, 2024
@github-actions github-actions bot removed the update snapshots 🤖 Command that updates VRT snapshots on the pull request label Jun 12, 2024
@github-actions github-actions bot temporarily deployed to storybook-preview-4666 June 12, 2024 14:47 Inactive
@TylerJDev TylerJDev marked this pull request as ready for review June 12, 2024 17:12
@TylerJDev TylerJDev requested a review from a team as a code owner June 12, 2024 17:12
@TylerJDev TylerJDev requested a review from camertron June 12, 2024 17:12
@github-actions github-actions bot temporarily deployed to storybook-preview-4666 June 12, 2024 17:16 Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-4666 June 21, 2024 17:53 Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-4666 July 12, 2024 20:21 Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-4666 July 12, 2024 20:36 Inactive
@TylerJDev
Copy link
Member Author

@primer/engineer-reviewers - Could I get a review on this PR? 👀

@siddharthkp siddharthkp self-requested a review July 25, 2024 16:18
@github-actions github-actions bot temporarily deployed to storybook-preview-4666 July 29, 2024 14:02 Inactive
@TylerJDev TylerJDev enabled auto-merge July 29, 2024 14:15
Copy link
Member

@siddharthkp siddharthkp left a comment

Choose a reason for hiding this comment

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

Left some clarifying questions

'aria-describedby': slots.blockDescription
? [blockDescriptionId, inactiveWarningId].join(' ')
: inactiveWarningId,
'aria-labelledby': `${labelId} ${slots.trailingVisual ? trailingVisualId : ''}`,
Copy link
Member

@siddharthkp siddharthkp Jul 30, 2024

Choose a reason for hiding this comment

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

  1. How do we decide if trailing visual should be in label or description?
  2. Are there places in dotcom which would end up with the wrong label / description from this?

Re: moving inline description from label to description, can we create a different PR for that because I'm less confident about that change. (I brought inline description from aria-describedby to aria-label #1599 after an accessibility review 😅)

I see from https://github.com/github/primer/issues/2501#issuecomment-1674987399,

We should probably have all instances of this component be referenced to via aria-describedby, instead of only the block variant. This is because the content in description might be a bit verbose to be included in the accessible name, regardless of the variant used.

This is really old, so forgive me for missing the details, but I think inline description was assumed to be short and label-like, which block description is for longer and even multi-line text. It's not mentioned in the design docs, so I wonder if primer-designers have thoughts on this as well

Copy link
Member Author

Choose a reason for hiding this comment

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

How do we decide if trailing visual should be in label or description?

I've added it as a label via aria-labelledby instead of a description because if there's text content within trailing visual, it's usually short and connects directly to the main item's text (accessibl, e.g.

<ActionList>
  <ActionList.Item>Tokens Available 
    <ActionList.TrailingVisual>8</ActionList.TrailingVisual>
  </ActionList.Item>
</ActionList>

Accessible name would be: "Tokens Available 8".

I mainly based this on examples I've seen in the wild. If we added it as a description, there's a chance it might be ignored, so I think aria-labelledby is a fair bet.

Are there places in dotcom which would end up with the wrong label / description from this?

I'd say it's very unlikely, since any text within the trailing visual isn't attached to ActionList.Item's accessible name/description currently.

Re: moving inline description from label to description, can we create a different PR for that because I'm less confident about that change.

Yup that's fair! I think it's worth its own discussion to see if we'd want to switch it or not, as it definitely works both ways, as part of the accessible name, or as part of the description. I'll take that change out of this PR and create another so that we can discuss/see if we want to include it or not!

Copy link
Member Author

Choose a reason for hiding this comment

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

Should now only include the proposed changed for TrailingVisual!

Copy link
Member

@siddharthkp siddharthkp Jul 31, 2024

Choose a reason for hiding this comment

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

I mainly based this on examples I've seen in the wild.

Does this also include within menus/selectpanels?

(Happy to go ahead with this, either of label vs description is better than aria-hidden i guess)

@github-actions github-actions bot temporarily deployed to storybook-preview-4666 July 30, 2024 20:11 Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-4666 July 30, 2024 20:23 Inactive
…ved-labels-descriptions-actionlist' into tylerjdev/add-improved-labels-descriptions-actionlist
@github-actions github-actions bot temporarily deployed to storybook-preview-4666 July 30, 2024 21:00 Inactive
Copy link
Member

@siddharthkp siddharthkp left a comment

Choose a reason for hiding this comment

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

Left a few tidying tasks, otherwise looks ready!

Approving in advance :)

[slots.blockDescription ? blockDescriptionId : undefined, inactiveWarningId ?? undefined]
.filter(String)
.join(' ')
.trim() || undefined,
Copy link
Member

Choose a reason for hiding this comment

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

Optional: Don't think we need trim now that we are filtering strings

Copy link
Member Author

Choose a reason for hiding this comment

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

I added this because we'd get aria-describedby=" " if none of the values were true. With the trim() || undefined, it will remove the attribute altogether since it's just an empty string at that point 🤔

<a
aria-current="page"
aria-labelledby=":r2:--label "
aria-labelledby=":r2:--label "
Copy link
Member

Choose a reason for hiding this comment

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

Could me make the filtering string on aria-labelledby as well so that we don't get these extra spaces 😅

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, definitely! I forgot I turned on auto merge 🤣, I can follow up in one of the PRs that I'll make for one of the sev-3 issues!

@TylerJDev TylerJDev added this pull request to the merge queue Jul 31, 2024
Merged via the queue into main with commit 04eac62 Jul 31, 2024
@TylerJDev TylerJDev deleted the tylerjdev/add-improved-labels-descriptions-actionlist branch July 31, 2024 13:25
@primer primer bot mentioned this pull request Jul 31, 2024
TylerJDev added a commit that referenced this pull request Jul 31, 2024
* Add `aria-describedby` to inline description; add `aria-labelledby` to `TrailingVisual`

* Update snapshots

* Add changeset

* Update snapshot

* Update packages/react/src/ActionList/Item.tsx

Co-authored-by: Siddharth Kshetrapal <[email protected]>

* changes from PR feedback

* Update .changeset/lovely-days-march.md

* Update snapshots

* Update lovely-days-march.md

---------

Co-authored-by: Siddharth Kshetrapal <[email protected]>
github-merge-queue bot pushed a commit that referenced this pull request Sep 9, 2024
* Focus close button on second step

* Remove `autofocus` prop

* Add dependencies to focus trap

* Add changeset

* lint fix

* Remove `body` from dependency

* add state to Dialog example

* chore(changeset): enter prerelease mode for v37 (#4789)

* chore(changeset): enter pre-release mode for v37

* ci: remove snapshots when in pre mode

* chore: add version info to all packages

* Revert "chore: add version info to all packages"

This reverts commit 4665bb3.

* chore: update canary to remove pre.json when running

---------

Co-authored-by: Josh Black <[email protected]>

* Autocomplete: Only open menu on click (#4771)

* Only open menu on click instead of just focus

* Update tests

* Add changeset

* Fix typo

* Set `openOnFocus` to `true`

* Add test, move `onFocus` function

* Update docs

* Adjust changeset

* Remove `useCallback`

* Add deprecated notice

* Prep for high contrast theme border-color changes (#4774)

* borders

* fallback

* test(vrt): update snapshots

* test color changes

* alright

* bump

* test(vrt): update snapshots

* more fixes

* test(vrt): update snapshots

* copy from main

* test(vrt): update snapshots

* Create fluffy-ravens-thank.md

* snippy snaps

* update seg control border

* test(vrt): update snapshots

* remove fallbacks

* copy from main

* test(vrt): update snapshots

---------

Co-authored-by: langermank <[email protected]>

* chore: add package version numbers (#4796)

Co-authored-by: Josh Black <[email protected]>

* feat: add postcss-preset-primer (#4751)

* feat: add postcss-preset-primer

* docs: update usage snippet

* chore: fix eslint rules and remove postcss-mixins

---------

Co-authored-by: Josh Black <[email protected]>

* Utilize `aria-describedby` on all `ActionList` descriptions (#4666)

* Add `aria-describedby` to inline description; add `aria-labelledby` to `TrailingVisual`

* Update snapshots

* Add changeset

* Update snapshot

* Update packages/react/src/ActionList/Item.tsx

Co-authored-by: Siddharth Kshetrapal <[email protected]>

* changes from PR feedback

* Update .changeset/lovely-days-march.md

* Update snapshots

* Update lovely-days-march.md

---------

Co-authored-by: Siddharth Kshetrapal <[email protected]>

* Wrap `header` and `footer` with `<Box>`

* Move `<Box>`

* Add back focus to story

* Update behaviors package

* Move back `useFocusTrap`

---------

Co-authored-by: Siddharth Kshetrapal <[email protected]>
Co-authored-by: Josh Black <[email protected]>
Co-authored-by: Josh Black <[email protected]>
Co-authored-by: Katie Langerman <[email protected]>
Co-authored-by: langermank <[email protected]>
@primer primer bot mentioned this pull request Oct 18, 2024
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