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

Can't add custom class to character count #1649

Closed
LBHELewis opened this issue Nov 18, 2019 · 3 comments · Fixed by #4566
Closed

Can't add custom class to character count #1649

LBHELewis opened this issue Nov 18, 2019 · 3 comments · Fixed by #4566
Assignees
Labels
breaking change character count feature request User requests a new feature 🕔 hours A well understood issue which we expect to take less than a day to resolve. nunjucks
Milestone

Comments

@LBHELewis
Copy link
Contributor

Currently it's not possible to add a custom class to the character count wrapper (.govuk-character-count) because the classes property is being used for the nested textarea instead. This goes against the convention in other components.

It would be helpful for us to have classes apply to the .govuk-character-count (or if this would be a problem because of introducing a breaking change then it would be helpful to have a new property that gives the ability to add custom classes to .govuk-character-count). In our use case we are re-skinning govuk-frontend for Hackney Council (see https://github.com/lbhackney-IT/lbh-frontend) and would like to alter the spacing around the character count component and to style the hint inside it without targeting solely .govuk-* classes (a convention that we're trying to stick to). There are ways of getting round this (not least breaking our convention in this case) so it isn't absolutely crucial to us, but would be nice if it could work the same way as all other components.

@kellylee-gds kellylee-gds added the awaiting triage Needs triaging by team label Nov 19, 2019
@NickColley NickColley added breaking change 🕔 hours A well understood issue which we expect to take less than a day to resolve. Priority: low feature request User requests a new feature and removed awaiting triage Needs triaging by team labels Dec 4, 2019
@NickColley
Copy link
Contributor

Hey Emma,

We recognise that the api for this component is inconsistent with the rest of our components.

To make it consistent we'd need to make a breaking change.

For this reason we'll see if more of our users run into this issue, and then consider changing this.

Let us know if this causes blockers for you, and we can reconsider this decision.

@vanitabarrett
Copy link
Contributor

As discussed in the v4 prioritisation, this component does work differently to our other components, so maybe it's ok that this is reflected in the macro options. This problem is wider than just classes, e.g: the macro options also let you pass in id and other HTML attributes that apply to the textarea, not the parent. There are probably 3 options here:

  1. We rename classes, id etc to textareaClasses, textareaId etc and introduce new macro options to apply to the parent that follow the macro options for our other components
  2. Introduce new macro options that apply to the parent, e.g: parentClasses, parentId. This would not be a breaking change
  3. Revisit the character count component and consider rolling it into the textarea component

Probably needs more investigation. It would also be good to know if this is something that causes an issue for a lot of our users, or if it behaves as expected despite being different to other design system components.

@colinrotherham
Copy link
Contributor

This is now ready for review as part of #4566

@colinrotherham colinrotherham moved this from Needs review 🔍 to Ready to release 🚀 in GOV.UK Design System cycle board Mar 6, 2024
@36degrees 36degrees added this to the [next] milestone Mar 11, 2024
@36degrees 36degrees moved this from Ready to release 🚀 to Done 🏁 in GOV.UK Design System cycle board Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change character count feature request User requests a new feature 🕔 hours A well understood issue which we expect to take less than a day to resolve. nunjucks
Projects
Development

Successfully merging a pull request may close this issue.

7 participants