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

Don't apply margins to <br> elements contained in an <li> in FF #350

Merged
merged 2 commits into from Apr 24, 2024

Conversation

thecrypticace
Copy link
Contributor

@thecrypticace thecrypticace commented Apr 23, 2024

Before this change the following would have unexpected extra space between the two lines of text in Firefox (but not in Safari or Chrome):

<div className="prose">
  <ul>
    <li>
      line 1
      <br />
      line 2
    </li>
  </ul>
</div>

Before, in FF:
before

After, in FF — now matching other browsers:
after

The intent of the selectors I've changed were to target leading/trailing p tags in a list item but we are targeting * instead. This had the side effect of causing <br> elements inside list items to gain a margin only in Firefox. Other browsers treat the <br> element like any other inline element and as such don’t apply margins.

Fixes #349

The intent of these selectors are to only target `p` tags but we are targeting `*:first-child` and `*:last-child`. This has a side effect of causing `<br>` elements inside the list item to gain a margin _only in Firefox_. Other browsers treat the `<br>` element as properly inline and as such don’t apply margins but FF does not seem to.
Copy link

vercel bot commented Apr 23, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
tailwindcss-typography ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 23, 2024 8:00pm

@thecrypticace thecrypticace changed the title Only fixup margins in p tags when inside a list item Don't apply margins to <br> elements contained in an <li> in FF Apr 23, 2024
@thecrypticace thecrypticace merged commit c0dea6c into master Apr 24, 2024
5 checks passed
@thecrypticace thecrypticace deleted the fix/issue-349 branch April 24, 2024 23:38
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.

Different rendering on Firefox
2 participants