question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bug: Multiple styles on the same text doesn't result in nested html tags

See original GitHub issue

I was playing with your rich-text-editor example and I noticed that having multiple styles on the same text doesn’t result in nested html tags, instead, it just keeps the first html tag and only updates its classes. For example, let’s say I make the text “hello” bold, this is the result:

<strong class="editor-text-bold">hello</strong>

Now I make the same text “italic”:

<strong class="editor-text-bold editor-text-italic">hello</strong>

I expected:

<em class="editor-text-italic"><strong class="editor-text-bold">hello</strong></em>

I’m not sure if this is the expected behavior or a bug. But I think in this situation most people expect em and strong tags to be nested.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
acywatsoncommented, Jun 29, 2022

This is the part that caught my attention:

Typically this element is displayed in italic type. However, it should not be used to apply italic styling;

I don’t disagree with your general point - just adding something for us (the team) to consider. We definitely want to make sure we are making things easy for users of popular libraries like Tailwinds. As a library that prioritizes accessibility, we just need to think about changes we make around semantics. Looking back over this, though, I think that adding em tags (in addition to the class) is most likely the right thing to do here.

0reactions
ahhshmcommented, Jul 3, 2022

Ok, thanks for replying. I’ll close this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why doesn't my nested paragraph respect font-size styles?
Simple answer is you can't nest p tags, if you open the console and inspect you will see the 2 p tags are...
Read more >
Two Issues Styling the Details Element and How to Solve Them
Issue 2: Nested block elements in <summary>​​ Nesting a block-level element (e.g. a heading) inside a <summary> element pushes that content down ...
Read more >
Handling common HTML and CSS problems - MDN Web Docs
Note: One common problem with CSS and HTML arises when different CSS rules begin to conflict with one another. This can be especially ......
Read more >
Nesting in Sass
...This indentation is just the recommended style for CSS code. While style declarations are indented within a their style rules, we're not ...
Read more >
HTML Elements - W3Schools
An HTML element is defined by a start tag, some content, and an end tag. ... All HTML documents consist of nested HTML...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found