SPIKE: Add character count for driving licence to details page #83
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.
Proposed changes
This is a working proof of concept for integrating the GDS Design System character count into the driving licence CRI form.
What changed
The character count component gives users a real-time countdown of the number of characters they have left to enter information. To make this work in the HMPO app context, these files were changed:
src/assets/scss/application.scss
to remove the resize user interface for the<textarea>
used by the character count componentsrc/locales/en/fields.yml
removes themaxlength
from the field, as setting maxlength does not report the status of user input to the user for screenreaderssrc/views/drivingLicence/details.html
uses the customhmpoCountText
nunjucks macro which instantiates the character count component for DVA and DVLA driving licencesrc/views/drivingLicence/hmpoCountText.njk
is a modification of thehmpoCount
nunjucks macro which displays the form field using the passed-in variables, with the addition of the character count macro.Currently the new form has not been tested to ensure that the information users supply is being sent to the backend correctly, but the validation does seem to be correct when tested with details from a real driving licence.