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
Select #60
Comments
Collating a few thoughts / experiments on Styled selectsAlthough the current version of the I have an example of a styled select experiment on this codepen iOS spinner control content croppingUsing the default For this reason options should be front loaded to emphasise the differences. Prefixing options like this:
has a greater chance of the important information being cropped off than if you front loaded the information that made the options different.
The You can force iOS to "shrink to fit" the full text of every option in a There is an example of this on this codepen Please note the Legend > Radios / Checkboxes alternative to
|
Note that there was a previous attempt to style the select element but it was never merged because we found there were issues making the (recreated) arrow indicator visible in browsers where the user had overridden colours. |
Can we add some examples of when it is okay to use a select component? Or if we don't have any, we should more explicitly say 'We have not seen any examples of a select component being necessary'. At the moment the current guidance "select should only be used as a last resort" seems a little vague. |
It's a good question. The idea of the current guidance is to try other things before using a select, as we know they have various problems. I think there's a good example of usage on Find a job (via @dashouse) I'm referring specifically to the 'sort by' select. Caveat - I haven't seen any research on this particular example. In this case, there is not much space to use radios - they would push the main content down the page a lot. The select has the 'right' number of items in it, few enough that you don't need to scroll within it, which is a problem for users. But more than two, which would probably be better as radios. Finally, the 'sort by' control is where users might expect it, from using other sites - at the top right, so redesigning the control and placing it elsewhere might not be a good option. |
Subtly suggesting I should go get a job somewhere else with that link? 😉 I think there's a couple of options that are available to Find a Job here - One being to have radio buttons over on the left-hand side with the filters, the other being to have a horizontally aligned list, like a nav bar, in place of the select. In terms of accessibility, I would have thought the first would be better as then the filter/sort tools are grouped together which lets people refine what they are looking at it in the same place. |
I'm pro avoiding selects, but we should keep in mind that there were a variety of issues uncovered in that research, and selects aren't always so bad. You're often balancing competing constraints and in some situations they may be the most appropriate component. Skimming Alice's video, and from memory, the issues with selects were:
Issues 1-3 aren't a problem when there's very few options of a known length. I hazard 5 wouldn't be an issue if there were a pre-selected value (such as in sort-by filters). 4 and 6 might remain an issue - though I wonder if fewer options might help people know when they've not selected an item - as might auto-submitting. A custom component like what @dashouse suggests above would be great. It might be able to accomodate multiple items being selected too? FWIW my service is using the the autocomplete with |
I came here looking for more guidance on using the select component. I'm using it temporarily in my prototype to simulate the autocomplete with I'd like it to be blank initially, and then let me pick from options. Regular selects can do this, but I can't see how you'd do it with the component. I can see in the nunjucks that If I don't preselect a value, it seems to default to the first value - how do I get it so I get a blank first entry? Skimming stackoverflow it sounds like some combination of |
One more from me! Widths of selects - is it ok to use a width override? Below our mobile breakpoint we set inputs and buttons to full width - but not selects. Is this intentional? Adding |
I'd like to suggest the guidance on selects be improved. It doesn't give details about the usability issues GDS originally found (back in 2013 now), but more importantly, those issues all apply to long lists in selects, not small lists. The guidance states "The select component allows users to choose an option from a long list." - but selects don't have to be for long lists. Indeed the example in the design system (sorting) is a good use for selects and is not a long list. I'm not aware of any usability issues when there are a small number of options in selects. Often, radios may present a clearer choice - but that's quite different than "only be used as a last resort" |
The other examples for radios, checkboxes have an example in error. But select does not. It'd be great to have one. Particularly as the error state uses a different class for errors. "govuk-select--error" |
There's an issue to do that – alphagov/govuk-design-system#1049 The problem we've run in to when trying to add an example is coming up with a realistic scenario where it both makes sense to have an error state and it fits with the usage guidelines. The example used elsewhere on the page is for sort order, where it doesn't really make sense to have an error as there would always (?) be a default sort order. If anyone has a good example from the service that we can use as an example, please add it to that issue. |
joelanman wrote:
The example of 'Find a job' may illustrate a point about 'select' but it's not a good example that scales out to UI in general. It uses two forms of concatenation:
Each of those constitutes a language-dependent design and is best avoided. |
"The problem we've run in to when trying to add an example is coming up with a realistic scenario where it both makes sense to have an error state and it fits with the usage guidelines." I'd like to include an error on this component if a user leaves it blank. It's a mandatory field however I can't highlight it if they dont select an option from the drop down. Am I using the correct component? |
Appreciate the select is a "last resort" but I think trying to find a perfect example of a good select as the criteria for an error is a tough one. It might just be a case of finding an internal system example, where in a high density screen it would feature without a preselected value and just use that. |
@haggishunt56 in many cases radios (single select), or checkboxes (multi select) are simpler options that work better for users than select |
Is there a reason this doesn't have a h1 on the govuk design system website? |
This was discussed on Slack, so attempting to record the answer here too. In the current example in the Design System, it’s unlikely that 'Sort by' would be the main question as part of ‘a one thing per page’ flow – it only makes sense as part of a more complicated user interface, such as a list of records. If the select was being used to answer the only/main question on the page, for example when following the 'One thing per page' approach, we'd expect the label to be inside an |
Great thanks @36degrees and @edwardhorsford for your help with this 🙂 |
@edwardhorsford did you ever implement a select with multiple items? Either way did you get any user research on how it performs, particularly from an accessibility perspective?
|
No I've not worked on a project that's done that, sorry. |
Use this issue to discuss this component in the GOV.UK Design System.
The text was updated successfully, but these errors were encountered: