Skip to content
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

Remove unnecesary class from Warning Text component #3569

Merged
merged 1 commit into from
May 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ We no longer support link buttons being disabled or using disabled styles.

This change was introduced in [pull request #3557: Remove deprecated `.govuk-button--disabled` class](https://github.com/alphagov/govuk-frontend/pull/3557).

#### Update the HTML for warning text

We've removed the `.govuk-warning-text__assistive` class and its styles from GOV.UK Frontend. This class is unnecessary, as it duplicates the functionality of the `.govuk-visually-hidden` class already present in Frontend.

If you’re not using Nunjucks macros, update your warning text HTML to replace the `govuk-warning-text__assistive` class with the `govuk-visually-hidden` class.

This change was introduced in [pull request #3569: Remove unnecesary class from Warning Text component](https://github.com/alphagov/govuk-frontend/pull/3569).

## 4.6.0 (Feature release)

### New features
Expand Down
4 changes: 0 additions & 4 deletions src/govuk/components/warning-text/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
padding: govuk-spacing(2) 0;
}

.govuk-warning-text__assistive {
@include govuk-visually-hidden;
}

.govuk-warning-text__icon {
@include govuk-font($size: false, $weight: bold);

Expand Down
2 changes: 1 addition & 1 deletion src/govuk/components/warning-text/template.njk
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
>
<span class="govuk-warning-text__icon" aria-hidden="true">!</span>
<strong class="govuk-warning-text__text">
<span class="govuk-warning-text__assistive">{{ params.iconFallbackText | default("Warning") }}</span>
<span class="govuk-visually-hidden">{{ params.iconFallbackText | default("Warning") }}</span>
{{ params.html | safe if params.html else params.text }}
</strong>
</div>
4 changes: 2 additions & 2 deletions src/govuk/components/warning-text/template.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('Warning text', () => {
it('renders with default assistive text', () => {
const $ = render('warning-text', examples.default)

const $assistiveText = $('.govuk-warning-text__assistive')
const $assistiveText = $('.govuk-visually-hidden')
expect($assistiveText.text()).toEqual('Warning')
})

Expand All @@ -42,7 +42,7 @@ describe('Warning text', () => {
it('renders custom assistive text', () => {
const $ = render('warning-text', examples['icon fallback text only'])

const $assistiveText = $('.govuk-warning-text__assistive')
const $assistiveText = $('.govuk-visually-hidden')
expect($assistiveText.html()).toContain('Some custom fallback text')
})

Expand Down