Bug: Multiple styles on the same text doesn't result in nested html tags
See original GitHub issueI 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:
- Created a year ago
- Comments:5 (5 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is the part that caught my attention:
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.Ok, thanks for replying. I’ll close this issue.