-
Notifications
You must be signed in to change notification settings - Fork 561
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
Support link underline preference #3848
Conversation
* adds Prose component and stories * adds tests and makes some minor changes * Create happy-rivers-attend.md * handle link underline preferences * adds visual regression testing * fixes storybook ID in Prose docs data * updates changeset with changed components data * rm Prose component * test(vrt): update snapshots * test(e2e): separate storybook global args by semicolon instead of ampersand * test(vrt): update snapshots * update snapshots --------- Co-authored-by: joshblack <joshblack@users.noreply.github.com>
🦋 Changeset detectedLatest commit: 08f8153 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
Uh oh! @joshblack, the image you shared is missing helpful alt text. Check your pull request body. Alt text is an invisible description that helps screen readers describe images to blind or low-vision users. If you are using markdown to display images, add your alt text inside the brackets of the markdown image. Learn more about alt text at Basic writing and formatting syntax: images on GitHub Docs. |
1 similar comment
Uh oh! @joshblack, the image you shared is missing helpful alt text. Check your pull request body. Alt text is an invisible description that helps screen readers describe images to blind or low-vision users. If you are using markdown to display images, add your alt text inside the brackets of the markdown image. Learn more about alt text at Basic writing and formatting syntax: images on GitHub Docs. |
Quick rollout plan notes from @mperrotti:
The postmortem for this incident was created over at: https://github.com/github/primer/discussions/2788 |
size-limit report 📦
|
@@ -26,6 +26,13 @@ const GlobalStyle = createGlobalStyle<{colorScheme?: 'light' | 'dark'}>` | |||
details-dialog:focus:not(:focus-visible):not(.focus-visible) { | |||
outline: none; | |||
} | |||
|
|||
/* Used to fake conditional styles using a technique by Lea Verou: https://lea.verou.me/blog/2020/10/the-var-space-hack-to-toggle-multiple-values-with-one-custom-property/ */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
omg so clever!
/* We have to use a zero-width space character (\u200B) as the value instead of a regular whitespace character because styled-components strips out properties that just have a whitespace value. */ | ||
:root {--prefers-link-underlines: \u200B;} | ||
[data-a11y-link-underlines='true'] { | ||
--prefers-link-underlines: initial; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you think of using the off/on variables like Lea suggested in her blogpost for a clearer understanding of this variable assignment?
@@ -22,9 +22,9 @@ const hoverColor = system({ | |||
|
|||
const StyledLink = styled.a<StyledLinkProps>` | |||
color: ${props => (props.muted ? get('colors.fg.muted')(props) : get('colors.accent.fg')(props))}; | |||
text-decoration: ${props => (props.underline ? 'underline' : 'none')}; | |||
text-decoration: ${props => (props.underline ? 'underline' : 'var(--prefers-link-underlines, underline)')}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming BaseStyles
is an optional wrapper... (correct me if it's not!)
Instead of changing the default, should we keep that default and let folks change the default by switching-on --prefers-link-underlines
?
text-decoration: props.underline ? 'underline' : 'var(--prefers-link-underlines, none)'
If --prefers-link-underlines
is not defined, for example when BaseStyles is not imported, the fallback would be none
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@joshblack @pksjce Does this sound right or am I missing the goal here?
|
||
/* Used to fake conditional styles using a technique by Lea Verou: https://lea.verou.me/blog/2020/10/the-var-space-hack-to-toggle-multiple-values-with-one-custom-property/ */ | ||
/* We have to use a zero-width space character (\u200B) as the value instead of a regular whitespace character because styled-components strips out properties that just have a whitespace value. */ | ||
:root {--prefers-link-underlines: \u200B;} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very cool hack! But we're only using this for one property: text-decoration so I'm not sure if we should prefer the explicit none
here?
Superseded by: #3946 |
This is a follow-up to #3720 after it was reverted for the latest release. Original description included below.
This was initiated by our need for underlined links in blocks of text, and supports dotcom's new user setting to render links with underlines. The link underline setting is currently being tested on dotcom behind a feature flag.
A new setting has been added to the Storybook toolbar that allows us to preview what a component would look like when the user has specified that they prefer link underlines.
Closes https://github.com/github/primer/issues/2536
Screenshots
User who turned link underlines on in their GitHub settings
Additional context about link underline settings
Issue: https://github.com/github/releases/issues/3340
Dotcom PR: https://github.com/github/github/pull/278701
Merge checklist
Take a look at the What we look for in reviews section of the contributing guidelines for more information on how we review PRs.