Skip to content

Commit 5bcb3e5

Browse files
authored
Merge pull request #2358 from hashicorp/hds-3773/update-title-defaults
`Modal`, `Flyout`: make the title an H1
2 parents a07009e + 6430245 commit 5bcb3e5

File tree

6 files changed

+37
-4
lines changed

6 files changed

+37
-4
lines changed

Diff for: .changeset/old-pots-argue.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@hashicorp/design-system-components": minor
3+
---
4+
5+
`Flyout`: Changed the HTML element wrapping the tagline and title from a `<div>` to a `<h1>`
6+
7+
`Modal`: Changed the HTML element wrapping the tagline and title from a `<div>` to a `<h1>`

Diff for: packages/components/src/components/hds/flyout/index.hbs

+5-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@
1515
{{yield
1616
(hash
1717
Header=(component
18-
"hds/dialog-primitive/header" id=this.id onDismiss=this.onDismiss contextualClassPrefix="hds-flyout"
18+
"hds/dialog-primitive/header"
19+
id=this.id
20+
onDismiss=this.onDismiss
21+
contextualClassPrefix="hds-flyout"
22+
titleTag="h1"
1923
)
2024
Description=(component "hds/dialog-primitive/description" contextualClass="hds-flyout__description")
2125
)

Diff for: packages/components/src/components/hds/modal/index.hbs

+5-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@
1515
{{yield
1616
(hash
1717
Header=(component
18-
"hds/dialog-primitive/header" id=this.id onDismiss=this.onDismiss contextualClassPrefix="hds-modal"
18+
"hds/dialog-primitive/header"
19+
id=this.id
20+
onDismiss=this.onDismiss
21+
contextualClassPrefix="hds-modal"
22+
titleTag="h1"
1923
)
2024
)
2125
}}

Diff for: showcase/app/templates/components/flyout.hbs

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474

7575
<Shw::Divider @level={{2}} />
7676

77-
<Shw::Text::H3>Body</Shw::Text::H3>
77+
<Shw::Text::H3 @tag="h2">Body</Shw::Text::H3>
7878

7979
<Shw::Flex @direction="column" as |SF|>
8080
<SF.Item @label="With basic style" class="shw-component-flyout-sample-item">
@@ -108,7 +108,7 @@
108108

109109
<Shw::Divider @level={{2}} />
110110

111-
<Shw::Text::H3>Footer</Shw::Text::H3>
111+
<Shw::Text::H3 @tag="h2">Footer</Shw::Text::H3>
112112

113113
<Shw::Flex @direction="column" as |SF|>
114114
<SF.Item @label="One action" class="shw-component-flyout-sample-item">

Diff for: showcase/tests/integration/components/hds/flyout/index-test.js

+9
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,15 @@ module('Integration | Component | hds/flyout/index', function (hooks) {
113113
assert.dom('.hds-flyout__tagline').doesNotExist();
114114
});
115115

116+
test('it renders the title as an h1', async function (assert) {
117+
await render(
118+
hbs`<Hds::Flyout id="test-flyout" as |F|>
119+
<F.Header @icon="info" @tagline="Tagline">Title</F.Header>
120+
</Hds::Flyout>`
121+
);
122+
assert.dom('.hds-flyout__title').hasTagName('h1');
123+
});
124+
116125
// DISMISS
117126

118127
test('it should always render the "dismiss" button', async function (assert) {

Diff for: showcase/tests/integration/components/hds/modal/index-test.js

+9
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,15 @@ module('Integration | Component | hds/modal/index', function (hooks) {
100100
assert.dom('.hds-modal__tagline').hasText('Tagline');
101101
});
102102

103+
test('it renders the title as an h1', async function (assert) {
104+
await render(
105+
hbs`<Hds::Modal id="test-modal" as |M|>
106+
<M.Header @icon="info" @tagline="Tagline">Title</M.Header>
107+
</Hds::Modal>`
108+
);
109+
assert.dom('.hds-modal__title').hasTagName('h1');
110+
});
111+
103112
// DISMISS
104113

105114
test('it should always render the "dismiss" button', async function (assert) {

0 commit comments

Comments
 (0)