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

Strong inside <a> causes rendering issues #275

Closed
surjithctly opened this issue Jul 11, 2022 · 5 comments · Fixed by #276
Closed

Strong inside <a> causes rendering issues #275

surjithctly opened this issue Jul 11, 2022 · 5 comments · Fixed by #276

Comments

@surjithctly
Copy link

surjithctly commented Jul 11, 2022

What version of @tailwindcss/typography are you using?

3.1.0

What version of Node.js are you using?

v16.0

What browser are you using?

Chrome

What operating system are you using?

MacOS

Reproduction repository

https://play.tailwindcss.com/VTb5NkiKvQ

Describe your issue

I have a simple usecase where <strong> tag is inserted inside <strong><a> but this doesn't display as expected.

I have given prose-violet and also prose-a:text-violet-500 but the color renders as black except the underline.

The sample code:

<div class="prose prose-violet prose-a:text-violet-500 p-16"> 
  <p>
    <strong>It is recommended to go through</strong>
    <a href="#" rel="noopener" target="_blank">
      <strong>Rollup's plugin documentation</strong>
    </a>
    <strong>first before reading the sections below.</strong>
  </p>
</div>

The current result.
image

Expected Result:
image

Live reproducible demo on Tailwind Play
https://play.tailwindcss.com/VTb5NkiKvQ

Thank you!

@surjithctly
Copy link
Author

Just noticed it affects the same for headings as well. Possibly everywhere strong is used inside.

Style causing this issue:

.prose :where(strong):not(:where([class~="not-prose"] *)) {
    color: var(--tw-prose-bold); /* this is black */
    font-weight: 600;
}

Possible fix:

Do we really need a color variable for strong since it can be inherited from the parent? Not sure!

@thecrypticace
Copy link
Contributor

Gonna be thinking this one through some today but as a quick fix you can add the following to your CSS to work around the problem:

.prose :where(strong):not(:where([class~="not-prose"] *)) {
  color: inherit;
}

@adamwathan
Copy link
Member

Do we really need a color variable for strong since it can be inherited from the parent? Not sure!

The main reason we do this is because <strong> tags have a different color than regular paragraph text in our default CSS (strong text is darker).

Probably can come up with a way to make this not happen by default though.

@reinink
Copy link
Member

reinink commented Jul 12, 2022

@surjithctly Hey thanks for reporting this. We've just made an update to this plugin where the strong and code color styles now inherit from their parent in headings, links, and blockquotes. I think this is generally a better default for these styles, and you can still override them if needed by adding custom styles 👍

@surjithctly
Copy link
Author

Thank you 🙏

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 a pull request may close this issue.

4 participants