Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
added a Text component #18495
added a Text component #18495
Changes from all commits
b804e72
de80cdc
d3325eb
56cc6cb
f8e5d14
1dcff30
726aadd
5943ded
408a907
8d0d288
8a87ff8
1fe6f2f
57e9542
10853c3
58e0ed2
1d4ace8
de00cb5
6d46659
e659e10
eee98ce
3fdd23f
0967a4d
b0d4d55
614a8ab
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the
title.large
option default toh1
? In general, it would be great to have this more opinionated so all popular HTML tags are covered with variants.as
can be still used to customize it if necessary.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could potentially do that. Is the location where
title.large
usually gets used usually ah1
too? (not just thinking about Gutenberg but thinking about other plugins too)If we change the default element for one variant, should we change the default element for the other variants too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is what I meant by saying – it would be great to have this more opinionated so all popular HTML tags are covered with variants. I assume that the whole idea is to stop using HTML tags, so this should make it easier to keep the code platform agnostic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍I'll let @davewhitley jump in to discuss whether there's a clear link between each variant and and a semantic element.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It wasn't designed with a heading level in mind, no. I'm hesitant to assign each heading level to a typographic style, because they should be separate. Each typographic style can use whatever HTML element is appropriate.
If we default to a
p
orh2
element for each style we are forcing the user of the component to make a choice on which heading level element to use, which is a good thing imo.I'm afraid that eventually people will just associate
h1
for Title Large, just as an example.I don't know enough about the Text component or how/when it should be used to give an authoritative answer though. I do know that I'm concerned about people ignoring the heading level and just using the default value, which will result in inaccessible markup. I'm also concerned about people choosing a specific typographic style because of the heading level associated with it. E.g. "I'll choose Title Medium because I need a level 2 heading". It’s important to realize that the style of a heading is independent from the semantic underlying element.
Maybe look at Material UI or Polaris to see how it's done?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure Polaris is helpful...
The
Display Text
variants (kind of like ourtitle.*
variants) maps to ap
.The
Heading
variant which offers a single size maps to ah2
.The
Subtitle
variant which offers a single size maps to ah3
.Everything other variant maps to a
p
.I'd advocate that we don't be overly opinionated by defaulting to anything other than a
p
at this time and wait and see how the component gets used and whether there are any consistent usage patterns that form and can be implemented into the component.