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

Define minimum width for select component #2670

Merged
merged 4 commits into from
Jul 15, 2022
Merged

Conversation

querkmachine
Copy link
Member

Adds a minimum width of the select component to account for situations where the value list may be loaded asyncronously, as requested in #2170.

As there is no 'standard' minimum width for selects, I opted to use 23 ex—equivalent to about 184 pixels wide on mobile, and 218 pixels wide on tablet and above.

I used 23 ex for a few reasons:

  • It is wide enough that it looks 'as expected' for a select, in the sense that it is noticably wider than it is tall.
  • It's the same width as a text input with the .govuk-input--width-10 class applied.
  • It can sit within .govuk-width-container and still comfortably fit on screens 240 pixels wide, which is the narrowest screen resolution with any significant presence in GOV.UK's analytics (the narrowest to be in triple digits, anyway), and one apparently still used on modern feature phones(!)

Comparisons

Mobile

Before After
image image

Tablet/desktop

Before After
image image

@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-2670 June 23, 2022 15:27 Inactive
@querkmachine querkmachine requested a review from a team June 23, 2022 15:27
@querkmachine querkmachine linked an issue Jun 23, 2022 that may be closed by this pull request
@owenatgov owenatgov added this to the [NEXT] milestone Jun 28, 2022
@owenatgov owenatgov self-requested a review June 28, 2022 16:34
Copy link
Contributor

@owenatgov owenatgov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One nitpick, otherwise looking sharp 👍🏻 This also needs a changelog entry (I think?)

@@ -7,6 +7,7 @@
@include govuk-font($size: 19, $line-height: 1.25);

box-sizing: border-box; // should this be global?
min-width: 23ex;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think your reasoning in the PR is sound. Is it worth trying to summarise that in a comment here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a code comment parroting my comment above.

Also added a changelog entry, currently listed as a fix, though I suppose this could also be a new feature, in a sense??

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, cheers! I see what you mean about it being a new feature potentially but my instinct is to keep it a fix as it's technically fixing the problem of the select not having a min-width.

@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-2670 June 29, 2022 10:24 Inactive
Copy link
Contributor

@owenatgov owenatgov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@vanitabarrett vanitabarrett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Marking this as 'request changes' only because we haven't reached agreement on using ex yet.

@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-2670 July 14, 2022 12:38 Inactive
@querkmachine
Copy link
Member Author

We've since merged a change to the Text Input component to use em units instead of ex. I've updated this PR to reflect that change.

@querkmachine querkmachine self-assigned this Jul 14, 2022
Co-authored-by: Vanita Barrett-Smith <vanita.barrett@digital.cabinet-office.gov.uk>
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-2670 July 15, 2022 09:54 Inactive
@querkmachine querkmachine merged commit 4d438db into main Jul 15, 2022
@querkmachine querkmachine deleted the select-min-width branch July 15, 2022 10:07
@36degrees 36degrees changed the title Define mininimum width for select component Define minimum width for select component Aug 1, 2022
@querkmachine querkmachine mentioned this pull request Aug 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Select min-width
4 participants