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(ActionList): do not truncate description by default #5169

Conversation

francinelucca
Copy link
Member

@francinelucca francinelucca commented Oct 23, 2024

Closes https://github.com/github/primer/issues/3472, Closes #4664

The current react implementation of ActionList.Description truncates the text by default which poses accessibility concerns due to the content not being able to be read by keyboard users. Additionally, the inline truncation can cause horizontal overflow which causes a WCAG reflow problem. This PR mimics the functionality of PVC's ActionList, which wraps the text instead of truncating by default. An additional truncate prop has been introduced to allow truncation functionality when applicable (documented here)

Before
rendered ActionList component with different descriptions including inline truncation but not inline without truncation
After
rendered ActionList component with different descriptions including inline with and without truncation

Changelog

New

  • Tests for ActionList.Description in block, inline truncation and inline no-truncation variants
  • New truncate prop on ActionList.Description

Changed

  • Modify ActionList TextWrapAndTruncation story to include new truncation/no-truncation use cases
  • Modify render behavior of ActionList.Description to not render inside a Truncate component if new truncate prop is false (false by default)
  • flex-basis style change on ActionList.Description to grow automatically if truncate is false
  • word-break is now set to normal instead of break-word if the Actionlist.Item contains an inline Actionlist.Description
  • Updates snapshots for VRT tests

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

Test new truncation behavior in TextWrapAndTruncation story

Merge checklist

Copy link

changeset-bot bot commented Oct 23, 2024

🦋 Changeset detected

Latest commit: 6e3b3ef

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 Minor

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

Copy link
Contributor

👋 Hi, this pull request contains changes to the source code that github/github depends on. If you are GitHub staff, we recommend testing these changes with github/github using the integration workflow. Thanks!

@github-actions github-actions bot added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Oct 23, 2024
Copy link
Contributor

github-actions bot commented Oct 23, 2024

size-limit report 📦

Path Size
packages/react/dist/browser.esm.js 98.73 KB (+0.07% 🔺)
packages/react/dist/browser.umd.js 99.07 KB (0%)

@primer-integration
Copy link

primer-integration bot commented Oct 23, 2024

🟢 golden-jobs completed with status success.

@francinelucca
Copy link
Member Author

Hi @langermank. Wanted to checkin about a slight difference I'm seeing here between PVC/PRC in relations to this PR and the word-break property. Wondering if we're ok with this or if we want to rethink this change? See video below

Screen.Recording.2024-10-23.at.6.15.04.PM.mov

…2-prcactionlist-inline-actionlist-description-is-automatically-truncated
@primer-integration
Copy link

👋 Hi from github/github! Your integration PR is ready: https://github.com/github/github/pull/350286

@github-actions github-actions bot added integration-tests: failing Changes in this PR cause breaking changes in gh/gh integration-tests: passing Changes in this PR do NOT cause breaking changes in gh/gh and removed integration-tests: passing Changes in this PR do NOT cause breaking changes in gh/gh integration-tests: failing Changes in this PR cause breaking changes in gh/gh labels Nov 6, 2024
@francinelucca
Copy link
Member Author

Will need these changes to be pulled into dotcom upon PRC version update

Copy link
Contributor

@langermank langermank left a comment

Choose a reason for hiding this comment

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

Lets go! 🚀

Copy link
Member

@broccolinisoup broccolinisoup left a comment

Choose a reason for hiding this comment

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

so cool 🔥

<Box
as="span"
sx={merge(styles, sx as SxProp)}
id={blockDescriptionId}
id={variant === 'block' ? blockDescriptionId : inlineDescriptionId}
Copy link
Member

Choose a reason for hiding this comment

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

I didn't know we have different IDs for inline and block 💭 good to know

Copy link
Member Author

Choose a reason for hiding this comment

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

was surprised by this one as well hahaah

expect(description).toHaveStyleRule('flex-basis', '0')
expect(description).toHaveStyleRule('text-overflow', 'ellipsis')
expect(description).toHaveStyleRule('overflow', 'hidden')
expect(description).toHaveStyleRule('white-space', 'nowrap')
Copy link
Member

Choose a reason for hiding this comment

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

Very detail tests!! Love it 🔥

I’m also curious to learn when you prefer to use Jest for visual style testing versus a tool like Playwright. 👀

Copy link
Member Author

Choose a reason for hiding this comment

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

That's a great question! I actually didn't take the fact that we already had a playwright test for the truncation story into account when writing these so this might be a bit "overkill" haha. I think I tend to go for Jest because it's what I'm most familiar with but love how "complete" vrt testing is in that it'll fail on the smallest visual change in the entire story so it feels like it covers more ground than a specific jest test. That being said I'm a big fan of redundancy.

Copy link
Member

Choose a reason for hiding this comment

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

love how "complete" vrt testing is in that it'll fail on the smallest visual change in the entire story so it feels like it covers more ground than a specific jest test.

Love this!

…onlist-description-is-automatically-truncated
@francinelucca
Copy link
Member Author

Will need these changes to be pulled into dotcom upon PRC version update

Tagging release conductor as FYI @siddharthkp, @broccolinisoup since I see you're next :)

@francinelucca francinelucca added this pull request to the merge queue Nov 12, 2024
Merged via the queue into main with commit a2efba0 Nov 12, 2024
43 checks passed
@francinelucca francinelucca deleted the francinelucca/3472-prcactionlist-inline-actionlist-description-is-automatically-truncated branch November 12, 2024 20:12
@primer primer bot mentioned this pull request Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: ActionList integration-tests: passing Changes in this PR do NOT cause breaking changes in gh/gh staff Author is a staff member status: review needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inline ActionList.Description can result in horizontal overflow
3 participants