hmrc / platui-support

Apache License 2.0
0 stars 0 forks source link

Issue with caption styling in HmrcPageHeadingLegend and HmrcPageHeadingLabel #18

Closed TheNickWilson closed 2 years ago

TheNickWilson commented 2 years ago

Library or service name

play-frontend-hmrc

Library version (where applicable)

3.11.0-play-28

Description of the issue

HmrcPageHeadingLegend and HmrcPageHeadingLabel both allow a caption to be added into the h1. However, they don't include the govuk-caption-xl class (or -l, -m etc.) that styles the caption. The result is that the caption has the same colour, size and weight as the main part of the h1.

Steps to reproduce the issue

Implement a component, for example some radio buttons with a caption, and observe the rendered HTML. For example:

@govukRadios(
                Radios(
                    fieldset = Some(Fieldset(
                        legend = Some(HmrcPageHeadingLegend(content = Text("Main heading"), caption = HmrcSectionCaption(Text("Caption"))))
                    )),
                    items = List(
                        RadioItem(content = Text("a"), value = Some("a")),
                        RadioItem(content = Text("b"), value = Some("b"))
                    )
                )
            )

Actual vs expected behaviour

The legend / label is rendered, with the hmrc-caption correctly applied to the relevant span, but without a class to style the caption. I would expect to be able to supply the size (xl, l etc.) and have the class applied to the relevant span.

From a brief inspection of the code, the HTML appears to be rendered by the pageHeadingCaption method on HmrcPageHeading.

Environment (where applicable)

N/A

TheNickWilson commented 2 years ago

So - it turns out the service I found this issue in was a couple of minor versions behind, and this was already fixed in a later version! Hence I'm closing the issue :)