-
Notifications
You must be signed in to change notification settings - Fork 328
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
Always set an explicit button type
, and bump html-validate from 8.2.0 to 8.3.0
#4113
Always set an explicit button type
, and bump html-validate from 8.2.0 to 8.3.0
#4113
Conversation
Looks like the behaviour of the The documentation for the type option says:
This is true for
However when the
We might want to either make this consistent or update the documentation. Do we want to fix as part of this PR or disable the rule and create an issue to address this later? |
@dependabot rebase |
Bumps [html-validate](https://gitlab.com/html-validate/html-validate) from 8.2.0 to 8.3.0. - [Release notes](https://gitlab.com/html-validate/html-validate/tags) - [Changelog](https://gitlab.com/html-validate/html-validate/blob/master/CHANGELOG.md) - [Commits](https://gitlab.com/html-validate/html-validate/compare/v8.2.0...v8.3.0) --- updated-dependencies: - dependency-name: html-validate dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]>
0bbd3a7
to
fa83143
Compare
📋 StatsFile sizes
Modules
View stats and visualisations on the review app Action run for 95366f7 |
@36degrees For the Design System failures we should probably be consistent and add missing button types in the PR It'll catch future problems should buttons be moved into Maybe the package will detect that in future Here though, we can override? Update: Changing button/template.njk isn't breaking so a quick commit? |
@36degrees I've pushed a commit, but with strings attached The Design System uses With the pushed fix it'll default to But really it's implicitly a submit button by default so still not a breaking change |
Our documentation says Button components as `<button>` should always default `params.type` to `submit`: > Type of `input` or `button` – `button`, `submit` or `reset`. Defaults to `submit`. This has no effect on `a` elements. Rather than rely on `<button>` to implicitly default to `type="submit"` we should set it in the HTML
9c2f5dc
to
95366f7
Compare
I don’t think we need to explicitly set the type to fulfil our documentation as the platform does that for us:
I see how that could help people debug buttons meant for JavaScript inadvertently submitting forms (though they probably should submit anyway for progressive enhancement or be injected via JavaScript with Regarding the Design System cookie banner, missing the type does not make any difference to the behaviour, so it’s not a big deal that this button defaults to being a submit. It doesn’t really feel like working with the grain of the platform for us to explicitly, redundantly set the type. Plus that makes it look like setting a default type to Just wanted to checked that the platform was already handling the default before we commit into setting it ourselves, as changing afterwards will be a breaking change. I'd be very fine with disabling that rule which I see more geared towards checking the HTML of full pages than library code. If we decide to go ahead (don't consider that comment blocking), it might be worth a little mention in the CHANGELOG, explaining that it helps debugging? |
I don't have a strong opinion on whether we should always set the type attribute, but I do think it'd be worth making the behaviour consistent between |
@36degrees I think that decides it? Otherwise we'd let this example get an implicit {{ govukButton({
text: "Save and continue",
element: "input"
}) }} When you'd expect |
Fair catch on the Going onwards, would we want to reconsider generating |
Hah. Somehow, I had not made the connection that we needed the I still think it's a little bit confusing that we say the |
Looks like we commented at the same time!
Yeah, we had a draft issue on https://github.com/orgs/alphagov/projects/41/views/1 to deprecate and remove this functionality. I think the only reason we've historically supported both options is because of bugs in IE6 and IE7(!) Maybe something to deprecate in v5.x and remove in v6? |
Thanks all Shall I keep the commit to always default to
Yeah. Can always go back to an implicit type in v6 |
For some history, we moved to implicit types back in: |
type
, and bump html-validate from 8.2.0 to 8.3.0
As part of a Dependabot update for `html-validate`, we made a change so that the button `type` attribute is always set (defaulting to `submit`, which is the same behaviour as if the `type` attribute is omittted) Although this isn’t a breaking change, I think it’s worth mentioning in the release notes. I’ve also updated the PR title to mention the change. This means the fix and the PR title are not identical, as I’ve omitted the `html-validate` bump here, but I think that’s OK.
Add changelog entry for #4113
Although Design System buttons were all fixed in #3116 we need this line until alphagov/govuk-frontend#4113 is released
…alidate-8.3.0 Bump html-validate from 8.2.0 to 8.3.0
Bumps html-validate from 8.2.0 to 8.3.0.
Release notes
Sourced from html-validate's releases.
Changelog
Sourced from html-validate's changelog.
Commits
6e952b1
chore(release): 8.3.0f2bc6e5
Merge branch 'feature/button-type' into 'master'd32f492
fix(html5):element-required-attributes
allows\<button>
withouttype
(u...38efd72
feat(rules): new ruleno-implicit-button-type
2b989e1
Merge branch 'ci/dep-scanner' into 'master'539fd7f
ci: remove deprecated license-scanner job33b84fa
Merge branch 'bugfix/empty-label-for' into 'master'90b7d00
refactor: get test cases up to spec3626e1a
fix(html5):\<label>
cannot have emptyfor
a2d552e
chore(deps): update dependency sass to v1.66.1Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase
will rebase this PR@dependabot recreate
will recreate this PR, overwriting any edits that have been made to it@dependabot merge
will merge this PR after your CI passes on it@dependabot squash and merge
will squash and merge this PR after your CI passes on it@dependabot cancel merge
will cancel a previously requested merge and block automerging@dependabot reopen
will reopen this PR if it is closed@dependabot close
will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot show <dependency name> ignore conditions
will show all of the ignore conditions of the specified dependency@dependabot ignore <dependency name> major version
will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself)@dependabot ignore <dependency name> minor version
will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself)@dependabot ignore <dependency name> dependency
will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself)@dependabot unignore <dependency name> dependency
will remove all of the ignore conditions of the specified dependency@dependabot unignore <dependency name> <ignore condition>
will remove the ignore condition of the specified dependency and ignore conditions