-
Notifications
You must be signed in to change notification settings - Fork 334
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
Edit content of error messages #4351
Conversation
📋 StatsFile sizes
Modules
View stats and visualisations on the review app Action run for 5d85080 |
ea7b4a4
to
1d338a6
Compare
1d338a6
to
9639396
Compare
5e9fe28
to
2205fd7
Compare
2205fd7
to
e898384
Compare
e898384
to
df9c023
Compare
df9c023
to
62d0955
Compare
element: this.$module, | ||
expectedType: 'string' | ||
}) | ||
throw new ElementError( |
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.
Here's an example of passing a message instead of options.
62d0955
to
ca31218
Compare
packages/govuk-frontend/src/govuk/components/character-count/character-count.mjs
Outdated
Show resolved
Hide resolved
ca31218
to
695318e
Compare
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.
Looking good @domoscargin
My comments are mainly thoughts for discussion really, see what you think
packages/govuk-frontend/src/govuk/components/character-count/character-count.mjs
Outdated
Show resolved
Hide resolved
packages/govuk-frontend/src/govuk/components/checkboxes/checkboxes.mjs
Outdated
Show resolved
Hide resolved
packages/govuk-frontend/src/govuk/components/checkboxes/checkboxes.mjs
Outdated
Show resolved
Hide resolved
packages/govuk-frontend/src/govuk/components/skip-link/skip-link.mjs
Outdated
Show resolved
Hide resolved
In cases where we want a very different error message, we can now just pass that directly. Co-authored-by: Brett Kyle <[email protected]> Co-authored-by: Colin Rotherham <[email protected]>
3530d15
to
91c5ee3
Compare
Thanks @colinrotherham - agreed with everything and have pushed some changes up. |
91c5ee3
to
0370716
Compare
packages/govuk-frontend/src/govuk/components/character-count/character-count.mjs
Outdated
Show resolved
Hide resolved
0370716
to
d27422c
Compare
d27422c
to
5e85724
Compare
5e85724
to
c2a9751
Compare
packages/govuk-frontend/src/govuk/components/checkboxes/checkboxes.mjs
Outdated
Show resolved
Hide resolved
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.
Fab work @domoscargin
Let's bring @romaricpascal in for HTML identifier feedback too
c2a9751
to
5d85080
Compare
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.
Looking great! The messages read nicely and it's a nice way to deal with one-off messages for the ElementError
🙌🏻 ⛵
Edit content of error messages
Closes #4072
Mostly following this comment: #4072 (comment)
And keeping track of which messages I've reviewed here: https://docs.google.com/spreadsheets/d/1_B5b1XLRzJLaJiAKpcW_ZByzjrHOVACRhrL29VVB7Lo/edit#gid=0
Custom messages
Thanks @colinrotherham for helping me out with this.
I've overloaded
ElementError
so it can be passed a straight-up string to be used as a message, or a set of options to construct a standard message. This allows us to easily cover unique cases.Accordion
This PR doesn't address Accordion messages, since that PR is still open and can be rebased on this one.