-
Notifications
You must be signed in to change notification settings - Fork 339
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
Fix examples that use the file upload in the review app #5666
Merged
romaricpascal
merged 2 commits into
spike-enhanced-file-upload
from
enhanced-file-upload-example-fixes
Jan 30, 2025
Merged
Fix examples that use the file upload in the review app #5666
romaricpascal
merged 2 commits into
spike-enhanced-file-upload
from
enhanced-file-upload-example-fixes
Jan 30, 2025
+77
−32
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
📋 StatsFile sizes
Modules
View stats and visualisations on the review app Action run for c4b5751 |
Rendered HTML changes to npm packagediff --git a/packages/govuk-frontend/dist/govuk/components/file-upload/template-enhanced-with-error-message-and-hint.html b/packages/govuk-frontend/dist/govuk/components/file-upload/template-enhanced-with-error-message-and-hint.html
new file mode 100644
index 000000000..01486bdc9
--- /dev/null
+++ b/packages/govuk-frontend/dist/govuk/components/file-upload/template-enhanced-with-error-message-and-hint.html
@@ -0,0 +1,12 @@
+<div class="govuk-form-group govuk-form-group--error">
+ <label class="govuk-label" for="file-upload-3">
+ Upload a file
+ </label>
+ <div id="file-upload-3-hint" class="govuk-hint">
+ Your photo may be in your Pictures, Photos, Downloads or Desktop folder. Or in an app like iPhoto.
+ </div>
+ <p id="file-upload-3-error" class="govuk-error-message">
+ <span class="govuk-visually-hidden">Error:</span> Error message goes here
+ </p>
+ <input class="govuk-file-upload govuk-file-upload--error" id="file-upload-3" name="file-upload-3" type="file" aria-describedby="file-upload-3-hint file-upload-3-error" data-module="govuk-file-upload">
+</div>
diff --git a/packages/govuk-frontend/dist/govuk/components/file-upload/template-javascript.html b/packages/govuk-frontend/dist/govuk/components/file-upload/template-enhanced.html
similarity index 100%
rename from packages/govuk-frontend/dist/govuk/components/file-upload/template-javascript.html
rename to packages/govuk-frontend/dist/govuk/components/file-upload/template-enhanced.html
Action run for c4b5751 |
Other changes to npm packagediff --git a/packages/govuk-frontend/dist/govuk/components/file-upload/fixtures.json b/packages/govuk-frontend/dist/govuk/components/file-upload/fixtures.json
index 9bae7f165..09d9a8427 100644
--- a/packages/govuk-frontend/dist/govuk/components/file-upload/fixtures.json
+++ b/packages/govuk-frontend/dist/govuk/components/file-upload/fixtures.json
@@ -159,7 +159,7 @@
"html": "<div class=\"govuk-form-group extra-class\">\n <label class=\"govuk-label\" for=\"file-upload-1\">\n Upload a file\n </label>\n <input class=\"govuk-file-upload\" id=\"file-upload-1\" name=\"file-upload-1\" type=\"file\">\n</div>"
},
{
- "name": "javascript",
+ "name": "enhanced",
"options": {
"id": "file-upload-1",
"name": "file-upload-1",
@@ -174,6 +174,28 @@
"screenshot": true,
"html": "<div class=\"govuk-form-group\">\n <label class=\"govuk-label\" for=\"file-upload-1\">\n Upload a file\n </label>\n <input class=\"govuk-file-upload\" id=\"file-upload-1\" name=\"file-upload-1\" type=\"file\" data-module=\"govuk-file-upload\">\n</div>"
},
+ {
+ "name": "enhanced, with error message and hint",
+ "options": {
+ "javascript": true,
+ "id": "file-upload-3",
+ "name": "file-upload-3",
+ "label": {
+ "text": "Upload a file"
+ },
+ "hint": {
+ "text": "Your photo may be in your Pictures, Photos, Downloads or Desktop folder. Or in an app like iPhoto."
+ },
+ "errorMessage": {
+ "text": "Error message goes here"
+ }
+ },
+ "hidden": false,
+ "description": "",
+ "previewLayoutModifiers": [],
+ "screenshot": false,
+ "html": "<div class=\"govuk-form-group govuk-form-group--error\">\n <label class=\"govuk-label\" for=\"file-upload-3\">\n Upload a file\n </label>\n <div id=\"file-upload-3-hint\" class=\"govuk-hint\">\n Your photo may be in your Pictures, Photos, Downloads or Desktop folder. Or in an app like iPhoto.\n </div>\n <p id=\"file-upload-3-error\" class=\"govuk-error-message\">\n <span class=\"govuk-visually-hidden\">Error:</span> Error message goes here\n </p>\n <input class=\"govuk-file-upload govuk-file-upload--error\" id=\"file-upload-3\" name=\"file-upload-3\" type=\"file\" aria-describedby=\"file-upload-3-hint file-upload-3-error\" data-module=\"govuk-file-upload\">\n</div>"
+ },
{
"name": "translated",
"options": {
@@ -341,28 +363,6 @@
"screenshot": false,
"html": "<div class=\"govuk-form-group govuk-form-group--error\">\n <label class=\"govuk-label\" for=\"file-upload-error-describedby-hint\">\n Upload a file\n </label>\n <div id=\"file-upload-error-describedby-hint-hint\" class=\"govuk-hint\">\n hint\n </div>\n <p id=\"file-upload-error-describedby-hint-error\" class=\"govuk-error-message\">\n <span class=\"govuk-visually-hidden\">Error:</span> Error message\n </p>\n <input class=\"govuk-file-upload govuk-file-upload--error\" id=\"file-upload-error-describedby-hint\" name=\"file-upload-error-describedby-hint\" type=\"file\" aria-describedby=\"test-target-element file-upload-error-describedby-hint-hint file-upload-error-describedby-hint-error\">\n</div>"
},
- {
- "name": "javascript, with error message and hint",
- "options": {
- "javascript": true,
- "id": "file-upload-3",
- "name": "file-upload-3",
- "label": {
- "text": "Upload a file"
- },
- "hint": {
- "text": "Your photo may be in your Pictures, Photos, Downloads or Desktop folder. Or in an app like iPhoto."
- },
- "errorMessage": {
- "text": "Error message goes here"
- }
- },
- "hidden": true,
- "description": "",
- "previewLayoutModifiers": [],
- "screenshot": false,
- "html": "<div class=\"govuk-form-group govuk-form-group--error\">\n <label class=\"govuk-label\" for=\"file-upload-3\">\n Upload a file\n </label>\n <div id=\"file-upload-3-hint\" class=\"govuk-hint\">\n Your photo may be in your Pictures, Photos, Downloads or Desktop folder. Or in an app like iPhoto.\n </div>\n <p id=\"file-upload-3-error\" class=\"govuk-error-message\">\n <span class=\"govuk-visually-hidden\">Error:</span> Error message goes here\n </p>\n <input class=\"govuk-file-upload govuk-file-upload--error\" id=\"file-upload-3\" name=\"file-upload-3\" type=\"file\" aria-describedby=\"file-upload-3-hint file-upload-3-error\" data-module=\"govuk-file-upload\">\n</div>"
- },
{
"name": "translated, no javascript enhancement",
"options": {
Action run for c4b5751 |
patrickpatrickpatrick
approved these changes
Jan 30, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Not quite sure how to implement the 'Form controls state' for the enhanced version.