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(feature-card): don't provide FeatureCard's href to ResourceC… #518

Merged
merged 11 commits into from
Nov 19, 2019
Merged

fix(feature-card): don't provide FeatureCard's href to ResourceC… #518

merged 11 commits into from
Nov 19, 2019

Conversation

jendowns
Copy link
Contributor

@jendowns jendowns commented Nov 13, 2019

Closes #517

As shown in #517, the FeatureCard currently takes an href and then adds that URL both a wrapper anchor element and to the inner ResourceCard component, which subsequently renders its own anchor element. As a result, the FeatureCard has nested anchors, which is invalid markup & generates a console error.

I propose a couple changes to fix this -- namely:

With these 2 changes, the FeatureCard will only render one anchor (the primary wrapper).

Changelog

New

  • add focus styles to FeatureCard

Changed

  • if no href is provided to ResourceCard, render as a div
  • FeatureCard no longer passes its href value down to the inner ResourceCard

@vercel
Copy link

vercel bot commented Nov 13, 2019

This pull request is being automatically deployed with ZEIT Now (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://zeit.co/carbon-design-system/gatsby-theme-carbon/3bb1xhi52
🌍 Preview: https://gatsby-theme-carbon-git-fork-jendowns-feature-card-anchors.carbon-design-system.now.sh

@vercel vercel bot temporarily deployed to staging November 13, 2019 17:25 Inactive
@jendowns
Copy link
Contributor Author

Tagging @dakahn 👍

@jendowns jendowns changed the title fix(feature-card): don't provide href to ResourceCard, render ResourceCard as div if no href fix(feature-card): don't provide FeatureCard's href to ResourceCard, render ResourceCard as div if no href Nov 13, 2019
@vercel vercel bot temporarily deployed to staging November 19, 2019 19:38 Inactive
@vercel vercel bot temporarily deployed to staging November 19, 2019 19:38 Inactive
@jendowns
Copy link
Contributor Author

jendowns commented Nov 19, 2019

Thanks @vpicone -- I just updated the focus outline to be 2px, but I left out an offset rule. Given the wrapping div where the outline has to be applied (due to margins etc), a negative offset would not be visible.

@vpicone vpicone changed the title fix(feature-card): don't provide FeatureCard's href to ResourceCard, render ResourceCard as div if no href fix(feature-card): don't provide FeatureCard's href to ResourceC… Nov 19, 2019
@vpicone vpicone merged commit e7cd119 into carbon-design-system:master Nov 19, 2019
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.

FeatureCard has nested anchors
2 participants