Skip to content

Commit

Permalink
Move header tag outside of header component
Browse files Browse the repository at this point in the history
- Change a Notification Banner test that created a second banner role, as this created an accessibility failure with the header always being present in the template
  • Loading branch information
querkmachine authored and domoscargin committed Jun 19, 2024
1 parent a8bffe2 commit c9b24e9
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</svg>
{% endset -%}

<header class="govuk-header {%- if params.classes %} {{ params.classes }}{% endif %}" data-module="govuk-header"
<div class="govuk-header {%- if params.classes %} {{ params.classes }}{% endif %}" data-module="govuk-header"
{{- govukAttributes(params.attributes) }}>
<div class="govuk-header__container {{ params.containerClasses | default("govuk-width-container", true) }}">
<div class="govuk-header__logo">
Expand Down Expand Up @@ -93,4 +93,4 @@
</div>
{% endif %}
</div>
</header>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ examples:
- name: custom role
hidden: true
options:
role: banner
role: dialog
text: This publication was withdrawn on 7 March 2014.

- name: classes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ describe('Notification-banner', () => {
const $ = render('notification-banner', examples['custom role'])
const $component = $('.govuk-notification-banner')

expect($component.attr('role')).toBe('banner')
expect($component.attr('role')).toBe('dialog')
})

it('renders aria-labelledby attribute matching the title id when role overridden to region', () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/govuk-frontend/src/govuk/template.njk
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@
}) }}
{% endblock %}

<header>
{% block header %}
{{ govukHeader({}) }}
{% endblock %}
</header>

{% block main %}
<div class="govuk-width-container {%- if containerClasses %} {{ containerClasses }}{% endif %}">
Expand Down

0 comments on commit c9b24e9

Please sign in to comment.