-
Notifications
You must be signed in to change notification settings - Fork 332
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
Allow the panel component title heading level to be customisable #853
Conversation
src/components/panel/template.njk
Outdated
@@ -1,9 +1,10 @@ | |||
{% set titleLevel = params.titleLevel if params.titleLevel else 1 %} |
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.
If the default is 1, this will be a breaking change, since before we were defaulting to H2.
Maybe we should default it to 2 and add a deprecation notice?
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.
In most cases it will (should) be an h1 so i guess a breaking change.
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.
filed under Breaking change
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.
If we're going to make this a breaking change we should probably hold this for now and batch it up with other breaking changes.
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 can make do this work and default to 2, then update the examples in the Design System to explicitly set the level as 1.
We'd then deprecate this behaviour and release the default as 1 in a breaking release later on?
Maybe I'm overcomplicating it.
2739ad0
to
2216612
Compare
src/components/panel/template.njk
Outdated
@@ -1,9 +1,10 @@ | |||
{% set titleLevel = params.titleLevel if params.titleLevel else 1 %} |
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.
Would headingLevel
be better suited?
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.
thought about that. we have titleText
, so 1st thought was titleHeadingLevel
to keep naming related, but that is wordy.
I also toyed with the idea to actually move the title to an object, to have:
title: {
text:
html:
headingLevel:
}
src/components/panel/index.njk
Outdated
text: 'no' | ||
}, | ||
{ | ||
text: 'Optional heading level, from 2 to 6. Default is 1.' |
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.
From 1 to 6.
2216612
to
f57dd5e
Compare
f57dd5e
to
b7022d8
Compare
b7022d8
to
2c05542
Compare
2c05542
to
f7b9789
Compare
f7b9789
to
4ab37b2
Compare
4ab37b2
to
50762ee
Compare
50762ee
to
6360f1c
Compare
6360f1c
to
cfef1ef
Compare
@@ -30,6 +30,22 @@ describe('Panel', () => { | |||
expect(panelTitle).toEqual('Application <strong>not</strong> complete') | |||
}) | |||
|
|||
it('renders title as h1 (as the default heading level)', () => { |
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.
h2
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.
Looks good, bar one comment which needs updating.
sorry to comment late, but didn't we want the default to be h1? As that's the common case for this panel? I thought I'd read we were going to do that somewhere? |
@joelanman making it h1 in the next breaking release: https://github.com/alphagov/govuk-frontend/milestone/2 |
cfef1ef
to
866e107
Compare
@igloosi ah cool thanks |
This modification allows it panel component title to be any heading level by specifying
headingLevel
parameterDefault is
2
.This PR
Adresses: alphagov/govuk-design-system#413