-
Notifications
You must be signed in to change notification settings - Fork 90
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
Custom radios / checkboxes #296
Conversation
de67f1d
to
c756b54
Compare
Tim Paul and me :) |
Oops! Fixed. |
Nice |
Some interesting information around touch sizes http://www.lukew.com/ff/entry.asp?1085 , might be relevant :P |
c756b54
to
de5098c
Compare
Interesting research! The actual input has increased in height from 29px to 37px, but as we’ve removed the grey background it no longer needs the padding which means that the overall height of the hit area has gone down from 60px to 37px. As long as people are still trying to press on the control maybe that’s not a problem though. |
Just remembered, I also want to get @cfq / @accessiblewebuk / @aduggin’s seal of approval on this before we merge, or at least before we do a release. |
@robinwhittleton Can you make a rendered version available on a public url (for example, in the sandbox) so we can get it fully tested? |
Why does it need to fall back to default inputs in a no js situation? |
|
Based on a design by @timpaul and @joelanman, (and as @joelanman pointed out) inspired by observations from user research. Plus lots of requests from me. |
Is this deployed anywhere we can try? What do these do on hover? Any thoughts on the below hover effect? (stolen from @selfthinker) |
Not yet.
No change. I like @selfthinker’s idea. What would you want to do with checkbox hover states?
Due to removal of padding I went for outline of the element (square with checkboxes): |
@robinwhittleton It's something I'd want to try in user research. I suspect you could do a greyed out tick on hover. I think once the radio or checkbox has been checked, hovering over it should not show the greyed symbol. An alternate would be to show a hover effect that is not the same as the tick or dot and could work whether the control was selected or not. Something like changing the white ring for a grey ring, or grey inner-stroke. Seperately - how do these work for people who use css to adjust contrast / change colours? |
It’s worth having the conversation about contrast issues, but my gut feeling is that browser-default checkboxes and radios already don’t respond to setting user colours? |
@robinwhittleton My worry is especially about something like this happening: Where the controls themselves disappear rather than being the wrong style. Chatting with @NickColley on Slack, it sounds like we may have a solution? |
The idea I put forward on slack was to remove the white background from the input and allow the colour to be defined by the text color of the label. In the above examples the container I set the Might be some edge cases I've not thought about though.. |
@robinwhittleton The current live verify radios do not work if the user has custom colours set (using firefox). Clicking on the option does nothing (visually). Where can I raise this? |
New issue on verify-frontend? The fix might be to complete this PR though and merge that in. |
This is ace, thanks Robin. Minor question: is the I might be missing something but I think the styles can all be based off the |
For the most part that wouldn’t be a problem, but imagine this situation:
Obviously good developers should test with JS disabled, but it’s easy for something to slip through. Wrapping all of this in a |
Makes sense. |
Windows has a high contrast theme that sets borders and background to different colours. In our case we’ve rendered the custom checkboxes using only borders, so that’s fine. The custom radio however has its outline rendered with a border, but the bullet rendered with a background. In high contrast mode the bullet was black-on-black and wasn’t showing. We can fix this by rendering the bullet with borders instead. We just set a width and height of 0, then make the border 10px thick on every side. Tested in IE8+, Fx, Chrome, old iOS Safari and IE Mobile.
6f6a1b0
to
4e50e9b
Compare
Thanks for all your work on this @robinwhittleton and to everyone else who contributed and offered advice. We'll release an update to govuk_elements for custom radio buttons and checkboxes today and update the govuk_prototype_kit to include them too. |
- made some minor adjustments to form to look good with new radio/checkbox styles - removed field_with_errors wrapping div which conflicts with new radio/checkbox JS modules Full list of changes: Remove the images path override from the helpers partial alphagov/govuk_elements#292 Bump govuk frontend toolkit to 4.16.1 alphagov/govuk_elements#288 Form validation patterns for conditionally revealing content alphagov/govuk_elements#286 Centre text on full-width buttons alphagov/govuk_elements#289 Lint JS code using StandardJS alphagov/govuk_elements#290 Update govuk_frontend_toolkit to 5.0.0 and govuk_template to 0.19.0 alphagov/govuk_elements#333 Add a select box example alphagov/govuk_elements#303 Add bullet points describing use of disabled buttons alphagov/govuk_elements#304 Add reasoning for native over custom file inputs Clear floats on details elements alphagov/govuk_elements#328 Add a .bold utility class alphagov/govuk_elements#321 Remove external link styles alphagov/govuk_elements#274 Remove rounded corners on form inputs elements and textareas in iOS alphagov/govuk_elements#342 Fix focus outline on form fields in Chrome / Safari alphagov/govuk_elements#346 Updates the contribution guidelines alphagov/govuk_elements#339 Recommend .visually-hidden over .visuallyhidden alphagov/govuk_elements#341 Add snippets for data visualisation examples alphagov/govuk_elements#350 alphagov/govuk_elements#351 Fix the grey left hand border example for Radios and checkboxes alphagov/govuk_elements#349 Fix the spacing underneath the "inline" block label example alphagov/govuk_elements#348 Custom radios / checkboxes alphagov/govuk_elements#296 Fix contrast issues with phase banners. Use $govuk-blue for the phase tag and update the examples alphagov/govuk_elements#364
- made some minor adjustments to form to look good with new radio/checkbox styles - removed field_with_errors wrapping div which conflicts with new radio/checkbox JS modules Full list of changes: Remove the images path override from the helpers partial alphagov/govuk_elements#292 Bump govuk frontend toolkit to 4.16.1 alphagov/govuk_elements#288 Form validation patterns for conditionally revealing content alphagov/govuk_elements#286 Centre text on full-width buttons alphagov/govuk_elements#289 Lint JS code using StandardJS alphagov/govuk_elements#290 Update govuk_frontend_toolkit to 5.0.0 and govuk_template to 0.19.0 alphagov/govuk_elements#333 Add a select box example alphagov/govuk_elements#303 Add bullet points describing use of disabled buttons alphagov/govuk_elements#304 Add reasoning for native over custom file inputs Clear floats on details elements alphagov/govuk_elements#328 Add a .bold utility class alphagov/govuk_elements#321 Remove external link styles alphagov/govuk_elements#274 Remove rounded corners on form inputs elements and textareas in iOS alphagov/govuk_elements#342 Fix focus outline on form fields in Chrome / Safari alphagov/govuk_elements#346 Updates the contribution guidelines alphagov/govuk_elements#339 Recommend .visually-hidden over .visuallyhidden alphagov/govuk_elements#341 Add snippets for data visualisation examples alphagov/govuk_elements#350 alphagov/govuk_elements#351 Fix the grey left hand border example for Radios and checkboxes alphagov/govuk_elements#349 Fix the spacing underneath the "inline" block label example alphagov/govuk_elements#348 Custom radios / checkboxes alphagov/govuk_elements#296 Fix contrast issues with phase banners. Use $govuk-blue for the phase tag and update the examples alphagov/govuk_elements#364
- made some minor adjustments to form to look good with new radio/checkbox styles Full list of changes: Remove the images path override from the helpers partial alphagov/govuk_elements#292 Bump govuk frontend toolkit to 4.16.1 alphagov/govuk_elements#288 Form validation patterns for conditionally revealing content alphagov/govuk_elements#286 Centre text on full-width buttons alphagov/govuk_elements#289 Lint JS code using StandardJS alphagov/govuk_elements#290 Update govuk_frontend_toolkit to 5.0.0 and govuk_template to 0.19.0 alphagov/govuk_elements#333 Add a select box example alphagov/govuk_elements#303 Add bullet points describing use of disabled buttons alphagov/govuk_elements#304 Add reasoning for native over custom file inputs Clear floats on details elements alphagov/govuk_elements#328 Add a .bold utility class alphagov/govuk_elements#321 Remove external link styles alphagov/govuk_elements#274 Remove rounded corners on form inputs elements and textareas in iOS alphagov/govuk_elements#342 Fix focus outline on form fields in Chrome / Safari alphagov/govuk_elements#346 Updates the contribution guidelines alphagov/govuk_elements#339 Recommend .visually-hidden over .visuallyhidden alphagov/govuk_elements#341 Add snippets for data visualisation examples alphagov/govuk_elements#350 alphagov/govuk_elements#351 Fix the grey left hand border example for Radios and checkboxes alphagov/govuk_elements#349 Fix the spacing underneath the "inline" block label example alphagov/govuk_elements#348 Custom radios / checkboxes alphagov/govuk_elements#296 Fix contrast issues with phase banners. Use $govuk-blue for the phase tag and update the examples alphagov/govuk_elements#364
Some changes had been made to the base we used for selection buttons from GDS. This PR documents a lot of the considerations that were made during developing this component: alphagov/govuk_elements#296
We're following the lead set by govuk_elements. No more background, but a bigger hit area for checkboxes and radio buttons. Also needed a change to our `selected` classname because that's how these new inputs are driven. Custom radios / checkboxes, in govuk_elements: alphagov/govuk_elements#296
Similar to the radios and checkboxes, govuk_elements have added new styles that increase the contrast of our form elements. Worth noting that we're explicitly _not_ bringing in spacing-related styles because we're Digital Marketplace and we do things differently here. Custom radios / checkboxes, in govuk_elements: alphagov/govuk_elements#296
We're following the lead set by govuk_elements. No more background, but a bigger hit area for checkboxes and radio buttons. Also needed a change to our `selected` classname because that's how these new inputs are driven. Custom radios / checkboxes, in govuk_elements: alphagov/govuk_elements#296
Similar to the radios and checkboxes, govuk_elements have added new styles that increase the contrast of our form elements. Worth noting that we're explicitly _not_ bringing in spacing-related styles because we're Digital Marketplace and we do things differently here. Custom radios / checkboxes, in govuk_elements: alphagov/govuk_elements#296
We're following the lead set by govuk_elements. No more background, but a bigger hit area for checkboxes and radio buttons. Also needed a change to our `selected` classname because that's how these new inputs are driven. Custom radios / checkboxes, in govuk_elements: alphagov/govuk_elements#296
Similar to the radios and checkboxes, govuk_elements have added new styles that increase the contrast of our form elements. Worth noting that we're explicitly _not_ bringing in spacing-related styles because we're Digital Marketplace and we do things differently here. Custom radios / checkboxes, in govuk_elements: alphagov/govuk_elements#296
We're following the lead set by govuk_elements. No more background, but a bigger hit area for checkboxes and radio buttons. Also needed a change to our `selected` classname because that's how these new inputs are driven. Custom radios / checkboxes, in govuk_elements: alphagov/govuk_elements#296
Similar to the radios and checkboxes, govuk_elements have added new styles that increase the contrast of our form elements. Worth noting that we're explicitly _not_ bringing in spacing-related styles because we're Digital Marketplace and we do things differently here. Custom radios / checkboxes, in govuk_elements: alphagov/govuk_elements#296
We're following the lead set by govuk_elements. No more background, but a bigger hit area for checkboxes and radio buttons. Also needed a change to our `selected` classname because that's how these new inputs are driven. Custom radios / checkboxes, in govuk_elements: alphagov/govuk_elements#296
Similar to the radios and checkboxes, govuk_elements have added new styles that increase the contrast of our form elements. Worth noting that we're explicitly _not_ bringing in spacing-related styles because we're Digital Marketplace and we do things differently here. Custom radios / checkboxes, in govuk_elements: alphagov/govuk_elements#296
We're following the lead set by govuk_elements. No more background, but a bigger hit area for checkboxes and radio buttons. Also needed a change to our `selected` classname because that's how these new inputs are driven. Custom radios / checkboxes, in govuk_elements: alphagov/govuk_elements#296
Similar to the radios and checkboxes, govuk_elements have added new styles that increase the contrast of our form elements. Worth noting that we're explicitly _not_ bringing in spacing-related styles because we're Digital Marketplace and we do things differently here. Custom radios / checkboxes, in govuk_elements: alphagov/govuk_elements#296
We're following the lead set by govuk_elements. No more background, but a bigger hit area for checkboxes and radio buttons. Also needed a change to our `selected` classname because that's how these new inputs are driven. Custom radios / checkboxes, in govuk_elements: alphagov/govuk_elements#296
Similar to the radios and checkboxes, govuk_elements have added new styles that increase the contrast of our form elements. Worth noting that we're explicitly _not_ bringing in spacing-related styles because we're Digital Marketplace and we do things differently here. Custom radios / checkboxes, in govuk_elements: alphagov/govuk_elements#296
The visual appearance of radio and checkbox form inputs changed in GOV.UK Elements here: alphagov/govuk_elements#296 This was subsequently reimplemented with different markup and no Javascript here: alphagov/govuk_elements#406 This has meant making the following changes to our app: - changing the markup in our radio/checkbox macros to match the example markup given by GOV.UK Elements - removing the previous Javascript file because it’s no longer needed to make the radios appear visual selected - making the buttons on the scheduled job picker look like links, because the grey button style looked weird with the new radio buttons
This requires no change to the existing HTML: the custom inputs are built using pseudoelements. In a no-JS / no-CSS / IE8 scenario it falls back to standard inputs. To style the radio and checkboxes differently a class is needed on the label - this is automatically added by the new SelectionButton JS.
This is partially based on Verify’s styles, and updates a design by @timpaul and @joelanman inspired by observations from user research and lots of requests from @cjforms. The inputs are sized to match the height of text inputs.
Tested on:
Android Browser on BrowserStack’s Nexus 4 (4.2) is massively unresponsive and doesn’t seem to let you click on the radios most of the time. It will need to be tested on a real device.
Would absolutely love any feedback.
currentColor
for compatibility with custom colour themes