nhsuk-frontend icon indicating copy to clipboard operation
nhsuk-frontend copied to clipboard

Use paragraphs for error messages

Open edwardhorsford opened this issue 1 year ago • 4 comments

Description

Fixes #1029.

I'm unsure if this should be considered a breaking change or not - might be worth a discussion.

Visually there should be no difference.

Before After
Video with span Video with paragraph

Checklist

edwardhorsford avatar Sep 24 '24 13:09 edwardhorsford

Had a quick test of this and I don't find any difference in how VoiceOver or NVDA read the error message.

VoiceOver reads error separately and NVDA reads the whole line as one, regardless of span or p.

VoiceOver (span then p)

NVDA (span then p)

anandamaryon1 avatar Apr 22 '25 08:04 anandamaryon1

@anandamaryon1 your first example shows a visual <p> in the heading - is that a bug or something you added to tell them apart? If the later, how do they compare to GOV.UK's error messages?

edwardhorsford avatar Apr 22 '25 11:04 edwardhorsford

@edwardhorsford @anandamaryon1 testing by GDS back in 2021 didn't seem to suggest there was any difference in screen reader treatment either? https://github.com/alphagov/govuk-frontend/issues/2083#issuecomment-979874842

frankieroberto avatar Apr 23 '25 12:04 frankieroberto

@anandamaryon1 your first example shows a visual <p> in the heading - is that a bug or something you added to tell them apart? If the later, how do they compare to GOV.UK's error messages?

Ah yes, that was just so that I could tell them apart.

I can have a look at GOV.UK's, I didn't check theirs.

anandamaryon1 avatar Apr 23 '25 15:04 anandamaryon1

Apologies this got left in limbo (for exactly a year!) @edwardhorsford…

Given that this will align us with GOV, shall we go ahead and merge this? Any reason not to @colinrotherham?

anandamaryon1 avatar Sep 24 '25 15:09 anandamaryon1

Ah perfect, just needs bringing back up to date

We've put https://github.com/nhsuk/nhsuk-frontend/issues/1029 against the v11.0.0 milestone currently

Just need to check if moving from <span> to <p> is 100% compatible (i.e. optional for non-Nunjucks libraries) then it can go in as a non-breaking change under v10.1.0 instead

colinrotherham avatar Sep 24 '25 16:09 colinrotherham