Skip to content
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

Add extra letter spacing modifier for inputs #2230

Merged
merged 3 commits into from
Mar 10, 2023
Merged

Conversation

36degrees
Copy link
Contributor

This is a re-implementation of the changes in #1222.


Add an --extra-letter-spacing modifier for inputs which increases the spacing between letters and turns on tabular numbers.

The idea is that this modifier would be used for inputs asking for things like security codes, reference or phone numbers, where the user would be checking back one character at a time.

This was inspired by alphagov/notifications-admin#1545

Without modifier

localhost_3000_components_input_extra-tracking-reference_preview 1

With modifier

localhost_3000_components_input_extra-tracking-reference_preview 2

@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-2230 May 18, 2021 15:46 Inactive
@36degrees 36degrees marked this pull request as draft May 18, 2021 15:51
@frankieroberto
Copy link
Contributor

@36degrees 🙌

@36degrees 36degrees closed this Nov 8, 2022
@romaricpascal romaricpascal reopened this Nov 21, 2022
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-2230 November 21, 2022 15:41 Inactive
@frankieroberto
Copy link
Contributor

Is this still planned to get merged at some point?

@romaricpascal
Copy link
Member

Hi @frankieroberto! Yup, the plan is to try and get this revived, reviewed by designers and add some guidance so we can get it in eventually 😄

@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-2230 November 28, 2022 10:58 Inactive
@romaricpascal romaricpascal added this to the [NEXT] milestone Feb 27, 2023
@romaricpascal
Copy link
Member

Added a changelog entry for the new class. Necessary, but also a way to get this merged and shipped without waiting to have more complete guidance in the Design System docs, which can come at a later stage (and be tracked in its own issue).

@36degrees @claireashworth Two questions:

  1. Does the changelog read OK?
  2. As I was writing it, occured to me that a better name for the modifier may be --digit-sequence (especially as it does more than adding letter spacing). Would it make sense to rename it?

@frankieroberto
Copy link
Contributor

frankieroberto commented Feb 28, 2023

  1. As I was writing it, occured to me that a better name for the modifier may be --digit-sequence (especially as it does more than adding letter spacing). Would it make sense to rename it?

I initially agreed with this, but then I thought you might also use it when asking people to input an alphanumeric code (or purely alphabetic?) in which case it might be confusing? And perhaps the letter spacing is more significant and obvious than the tabular numerals?

That said, I like the idea of having a more semantic name rather than one that just describes the styles applied (which might change). --code-sequence maybe?

@romaricpascal romaricpascal force-pushed the extra-letter-spacing branch from 24c24f4 to d382de3 Compare March 6, 2023 09:36
@romaricpascal
Copy link
Member

I initially agreed with this, but then I thought you might also use it when asking people to input an alphanumeric code (or purely alphabetic?) in which case it might be confusing? And perhaps the letter spacing is more significant and obvious than the tabular numerals?

That said, I like the idea of having a more semantic name rather than one that just describes the styles applied (which might change). --code-sequence maybe?

Yeah, digit is not really accurate there, that's true. Would code encompass phone numbers as well? Otherwise, maybe we could refer to "characters" (would it be understood as "non-digits" though?): --character-sequence or --character-by-character. Or maybe just --sequence without mentioning which kind of sequence it is: it's not really important and you're typing "characters" anyways, after all.

@querkmachine
Copy link
Member

Of those options, I'd go for --character-sequence.

Hopefully, the folks using this may already be familiar with the idea that a character is just any one glyph—be it letter, digit, punctuation or whitespace—from the character count component. --sequence alone feels like it might be too vague?

@frankieroberto
Copy link
Contributor

My thinking behind --code-sequence was to describe where this could be used - ie when the user is entering a code rather than a number or word. --character-sequence feels quite technical to me, and perhaps too vague (isn't everything a character sequence, including words?)

Language is hard though! Maybe --extra-letter-spacing was the clearest after all... 😂

@querkmachine
Copy link
Member

I'm more inclined towards naming things after the purpose they serve, rather than what they are, but that isn't a hard and fast rule by any means.

However, as this style change is not only applying additional letter-spacing, but is also explicitly enabling tabular number formatting, I think it should be named something akin to --code-sequence in favour of --extra-letter-spacing. The former feels more accurate and more future-proof, in my mind.

@calvin-lau-sig7
Copy link
Contributor

Suggestions:
If it's fixed spacing (monospacing, fixed-character-spacing)
It it's just a little extra space being added in there (extra-spacing, distinct-spacing, separated-spacing)

@calvin-lau-sig7
Copy link
Contributor

Suggestion: readable-spacing

Or:

  • readable-characters
  • monospacing
  • fixed-character-spacing
  • extra-spacing
  • distinct-spacing
  • separated-spacing

@querkmachine
Copy link
Member

Suggestions:
If it's fixed spacing (monospacing, fixed-character-spacing)
It it's just a little extra space being added in there (extra-spacing, distinct-spacing, separated-spacing)

I think that's part of the contention, @calvin-lau-sig7 — it's both!

@owenatgov
Copy link
Contributor

Jumping in with the opinion that we should keep the name as simple as possible. I think --extra-letter-spacing is a fine choice. Says what it does in the broad sense. I also like --monospacing or --monospaced as a catch-all.

At the end of the day though there is a ceiling to what value we can get out of picking the perfect word or phrase to explain what it's doing. I don't think we need to split hairs on precision of what we choose (appreciate I just contributed to this!). What it is now seems to do the job, in my opinion.

@romaricpascal romaricpascal marked this pull request as ready for review March 9, 2023 15:27
@romaricpascal
Copy link
Member

Let's keep it --extra-letter-spacing then 😄

Co-authored-by: CAAshworth <claire.ashworth@digital.cabinet-office.gov.uk>
@querkmachine querkmachine force-pushed the extra-letter-spacing branch from d382de3 to c8ae9f3 Compare March 10, 2023 09:44
@querkmachine querkmachine merged commit 0db5915 into main Mar 10, 2023
@querkmachine querkmachine deleted the extra-letter-spacing branch March 10, 2023 09:48
@frankieroberto
Copy link
Contributor

@querkmachine woohoo! 🙌

Can you add this modifier to confirm a phone number inputs?

@querkmachine
Copy link
Member

@frankieroberto I think this might warrant a bit more documentation outside of updating certain examples, so I've opened an issue for it here: alphagov/govuk-design-system#2665

@romaricpascal romaricpascal mentioned this pull request Apr 20, 2023
peteryates added a commit to x-govuk/govuk-form-builder that referenced this pull request Apr 21, 2023
When true, the extra_letter_spacing argument adds the class
'govuk-input--extra-letter-spacing' to the text input element. It is
available for all text fields and defaults to false.

alphagov/govuk-frontend#2230
peteryates added a commit to x-govuk/govuk-form-builder that referenced this pull request Apr 23, 2023
When true, the extra_letter_spacing argument adds the class
'govuk-input--extra-letter-spacing' to the text input element. It is
available for all text fields and defaults to false.

alphagov/govuk-frontend#2230
zheileman added a commit to ministryofjustice/laa-apply-for-criminal-legal-aid that referenced this pull request May 26, 2023
Update GDS and MOJ design systems to their latest releases.

Update form builder to latest version 4.0.0

This version finally incorporates the improvements to localisation in nested fields, so we can get rid of some superfluous code in the co-defendant and offence pages.
x-govuk/govuk-form-builder#386

Also, a new `extra_letter_spacing` can be used in input texts like reference numbers, telephones, codes, etc. that makes it easier to read. I've added this flag where it makes sense in our service.
alphagov/govuk-frontend#2230
zheileman added a commit to ministryofjustice/laa-apply-for-criminal-legal-aid that referenced this pull request May 26, 2023
Update design system and form builder

Update GDS and MOJ design systems to their latest releases.

Update form builder to latest version 4.0.0

This version finally incorporates the improvements to localisation in nested fields, so we can get rid of some superfluous code in the co-defendant and offence pages.
x-govuk/govuk-form-builder#386

Also, a new `extra_letter_spacing` can be used in input texts like reference numbers, telephones, codes, etc. that makes it easier to read. I've added this flag where it makes sense in our service.
alphagov/govuk-frontend#2230
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

8 participants