You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(ui-heading): fix Heading rendering as H2 in most cases
Previously it was rendering h2 in lots of cases when it should not. Make the order more clear, add
documentation to it
To test: Check if Heading's DOM levels correspond to the logic stated in the documentation.
Fixes INSTUI-4657
Copy file name to clipboardExpand all lines: packages/ui-heading/src/Heading/README.md
+32-23Lines changed: 32 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,33 +4,39 @@ describes: Heading
4
4
5
5
Heading is a component for creating typographic headings.
6
6
7
-
## Variant
7
+
###Variant
8
8
9
9
Variant covers almost all use cases for headings on pages. Their name reflects the places they meant to be used. It takes care of the style of the heading
10
10
11
-
NOTE 1: for legacy reasons, each `variant` has a default `level` set. This is not the recommended way and will be removed in a later major release. Please specify the `level` directly!
12
-
13
-
NOTE 2: when `variant` is set the `as` prop is ignored
14
-
15
-
IMPORTANT A11Y NOTE 1: there can be only one `h1` tag in a page
16
-
17
-
IMPORTANT A11Y NOTE 2: `h` tags can not skip a level, so for example an `h1` followed by an `h3` not allowed
11
+
```js
12
+
---
13
+
type: embed
14
+
---
15
+
<Alert variant="info">
16
+
<List margin="0 0 medium">
17
+
<List.Item>For legacy reasons, each <code>variant</code> has a default <code>level</code>set. This is not the recommended way and will be removed in a later major release. Please always specify the <code>level</code>!</List.Item>
18
+
<List.Item>When <code>variant</code> is set the <code>as</code> prop is ignored</List.Item>
19
+
<List.Item>A11YGUIDELINE: There can be only one <code>h1</code> tag in a page</List.Item>
20
+
<List.Item>A11YGUIDELINE:<code>h</code> tags can not skip a level, so for example an <code>h1</code> followed by an <code>h3</code> not allowed</List.Item>
Generate content headings, from h1 to h5. Use the `margin` prop to add margin.
60
+
What DOM element is output is determined in the following order:
55
61
56
-
- The `as` prop controls what html element is output. _(if not defined it will default to level)._
57
-
- The `level` prop sets its appearance.
62
+
1. (deprecated) If the variant prop is set, then the value of level prop. If variant is set but level is not, <h1>-<h6> based on the variant prop's value.
63
+
2. The value of the `as` prop
64
+
3. The value of the `level` prop
65
+
4.`<h2>`
66
+
67
+
The `variant` and `level` props sets its appearance in this order.
0 commit comments