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

Update secondary button style #1077

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

Update secondary button style #1077

wants to merge 10 commits into from

Conversation

davidhunter08
Copy link
Contributor

@davidhunter08 davidhunter08 commented Nov 20, 2024

Description

A proposal to change the secondary button visual style.

Current design

Screenshot 2024-11-20 at 16 06 15

Proposed design

secondary-button

Supporting information

Checklist

@michaelgallagher
Copy link

the states make sense and seem logical to me

@chrimesdev
Copy link
Member

Fixed the BackstopJS tests.

It looks like support is being removed for disabled buttons #1075 - I wonder if this needs updating here too?

@anandamaryon1
Copy link
Collaborator

Fixed the BackstopJS tests.

It looks like support is being removed for disabled buttons #1075 - I wonder if this needs updating here too?

We're thinking of removing the disabled class, which we think is only used for links styled as buttons, leaving the :disabled state styling. Links styled as buttons shouldn't be disabled, because links can't be disabled. Open to any thoughts on this though.

@anandamaryon1
Copy link
Collaborator

This is looking good to me @davidhunter08! Nice work.

Bottom radius stroke is ever so slightly funky but I can't think of a way to fix it, I'm sure you've thought about it too.

Only think I can notice is the pseudo :before click overlay overhangs by 2px:
image
It's position: absolute so it doesn't affect layout, but maybe still worth tidying up?

@davidhunter08
Copy link
Contributor Author

Thanks @anandamaryon1. Good spot on the overlay overhang, I've fixed that.

Screenshot 2024-11-21 at 14 50 00

Re: Bottom radius stroke, yeah it's a bit annoying, I've tried a few implementations but that's the best I've got so far. I'll try some other things this afternoon.

@davidhunter08
Copy link
Contributor Author

1. As is

border 2px
bottom-border 0
box-shadow 4px

Screenshot 2024-11-21 at 14 59 24

2. Decrease box shadow

border 2px
box-shadow 2px

Screenshot 2024-11-21 at 15 02 09

3. Remove box shadow

border 2px
bottom-border 4px
box-shadow 0

Screenshot 2024-11-21 at 15 03 21

@anandamaryon1
Copy link
Collaborator

@davidhunter08 thanks, option 2 looks to solve it, but needs focus style tweaks too:

border-bottom: 0; added to .nhsuk-button--secondary:focus seems to work for me.

@davidhunter08
Copy link
Contributor Author

Thanks @anandamaryon1, I've updated the code to option 2 and sorted the focus state.

CleanShot 2024-11-21 at 15 48 57

@frankieroberto
Copy link
Contributor

Looks good to me! I’ve been avoiding using the existing secondary button in our service as some users in research sessions have assumed it was inactive/disabled, and this should solve that.

@@ -7,12 +7,18 @@
* 2. Fix unwanted button padding in Firefox.
* 3. Use a pseudo element to expand the click target area to include the
* button's shadow as well, in case users try to click it.
* 4. Makes the secondary button that has a border the same height as the other
* buttons that don't have a border.
*/

// Because the shadow (s0) is visually 'part of' the button, we need to reduce
// the height of the button to compensate by adjusting its padding (s1) and
// increase the bottom margin to include it (s1).
Copy link
Collaborator

Choose a reason for hiding this comment

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

Second (s1) should be (s2)?

@StephenHill-NHSBSA
Copy link

StephenHill-NHSBSA commented Nov 25, 2024

Just to add my two-penneth.... Changes all look good and make complete sense to me. To tie any changes up in a nice shiny bow though (🎁) it would be good to attach any user research insights to this - just to confirm the original user need, and where the suggested change meets this! 🙂

@davidhunter08 davidhunter08 marked this pull request as ready for review November 25, 2024 16:11
@davidhunter08
Copy link
Contributor Author

Just to add my two-penneth.... Changes all look good and make complete sense to me. To tie any changes up in a nice shiny bow though (🎁) it would be good to attach any user research insights to this - just to confirm the original user need, and where the suggested change meets this! 🙂

Thanks @StephenHill-NHSBSA - totally agree. I'll link to the research findings once they've been documented in GitHub, which should be this week 👍

@benchilds
Copy link

benchilds commented Nov 25, 2024

From a mostly subjective perspective, but also slightly informed by the occasional feedback (I think?) that the current secondary button style sometimes gets mistaken for being a disabled state, I'm surprised to see the secondary button style presented as a 'border only' style – especially one with a transparent background.

I recognise that the 'solid button with brand colour bg + bordered button with brand colour border' is a widely-used style for 'Sign-in or Register' adjacent buttons, so perhaps that has now established it as a solid pattern, but I think the use of the same 'action' colour is surely important in those contexts? (All of which is purely visual I appreciate). Given that the primary button colour is solid green, I'd have thought the obvious interpretation of that in the bordered style would be a green border? e.g. DO THIS PRIMARY GREEN THING! Or consider doing this other secondary green thing!

Maybe all of this has already been considered – apologies for jumping in a bit cold from a thread elsewhere – but I'd also be intrigued to see the research findings, and whether the green bordered style was considered.

Update: Now with a hastily hacked together example via browser hacking:

image

I don't think the above is a perfect design by any means. And I have obviously not made any of the undoubtedly thorough considerations in the proposed solution. But, I think a frequent outcome of the proposed solution, assuming primary and secondary buttons are often used adjacently, would be as below, which doesn't feel like a cohesive design (IMO):

image

Last thing, I understand the preference to do one thing per page. However, in practice, even when supporting one primary thing on a page, there is frequently a need to use two buttons (even allowing for the 'primary button' with cancel as a link pattern).

@davidhunter08
Copy link
Contributor Author

davidhunter08 commented Nov 26, 2024

Hey @benchilds - yeah we found the same problems on the NHS App, users mistaking the the current (grey) secondary button as disabled. Based on that, and some earlier thinking in the community backlog, we created a design hypothesis around changing the style/colours, which tested well with users.

Border style

In regards to the style, I wouldn't say the design is 'border only' as it has the thicker bottom border that elevates it and gives it affordance, like the primary button. It is similar to the feedback buttons on the GOV.UK:

Screenshot 2024-11-26 at 09 29 22

Colours

Green was considered early on but was deemed not as versatile as the blue (@Tosin-Balogun might be able to expand on this?). On the app there's no instances of the primary and secondary button being used together, but there are instances of the primary and secondary buttons being used with text links.

button-group-examples

So having it blue makes it feel more cohesive on the app but I do agree that the green is more cohesive when used with a primary button.

secondary-button-colour

111 online

The button design and research from 111 online:.

Screenshot 2024-11-26 at 09 19 34

@frankieroberto
Copy link
Contributor

I don’t have any views on the green vs blue. @davidhunter08 did you explore using a white background colour instead of transparent? That’d have increased text contrast, but possibly it’d stand out too much?

@michaelgallagher
Copy link

michaelgallagher commented Nov 26, 2024

@frankieroberto

... did you explore using a white background colour instead of transparent? That’d have increased text contrast, but possibly it’d stand out too much?

just my hunch, but an outline (green or blue) with a white BG feels very much like a different style for a primary button if you don't have it right next to the solid green button

@davidhunter08
Copy link
Contributor Author

I don’t have any views on the green vs blue. @davidhunter08 did you explore using a white background colour instead of transparent? That’d have increased text contrast, but possibly it’d stand out too much?

@frankieroberto we considered a white background but we felt a transparent background would be more versatile, as it would work on both grey (page colour) and white (card) backgrounds. All our testing so far has been a transparent background sitting on the grey page colour.

@anandamaryon1
Copy link
Collaborator

Good point on considering the colour @benchilds, to add another point to factor in: we're considering adding an NHS login button, which will be essentially a blue primary button.

This makes me verge more towards it being green (or grey as it currently is?), and not blue.

@Tosin-Balogun
Copy link

Tosin-Balogun commented Nov 26, 2024

@anandamaryon1

I initially started this issue after some experiences I had trying to design dashboards for clinical systems on screening. Quite a lot of thinking has gone into this already which dates back to 2022.
nhsuk/nhsuk-service-manual-community-backlog#417

The green idea was considered early on in my sketches but it didn't work well or felt versatile enough to sit within our wider component library.

Visually, it also didn't make sense when I tried it within a lot of other components (Tables, Expanders, Cards etc), so I actually abandoned green very early in my thinking.

At the time, I was also doing an audit of our component library for other things not just buttons
https://app.mural.co/t/nhsdigital8118/template/614020db-c17d-4c5e-9155-7c6df6297802

Buttons

Other stronger candidate was grey but it also either didn't feel versatile enough to be a secondary option and be visible enough at the right amount.

We also use blue quite a lot more for call to actions around most of our components, so hierarchy wise, it make sense to start from bottom-up, therefore green exist as a primary loud button.

What @benchilds is talking about only works if we had designed the whole system around the green button and did it top-down, but we did not do that. Our visual style starts from neutrals to blue to green (which we use sparingly)

image

Another thing that factor into my thinking was that 111online had been user testing it at the time and I introduced it to campaigns which we tested as well (It tested well with users). We also used to have a 'menu' option on the header prior which used similar style (later replaced with 'more' dropdown).

In total, we have tested it on 3 different kinds of products (campaigns, 111online and on the app)

@frankieroberto A solid fill white button is literally the reverse primary (i.e the green button but reversed for darker backgrounds), which also removes the hierarchy level it was meant to sit within (as you hinted).

PS: This is not a call to change the green primary button to blue because we do not need to become monochromatic for uniformity. The green is our loudest cta and its effective as it is, perhaps that is a different convo

@edwardhorsford
Copy link
Contributor

To add some more examples to the mix, here's some buttons from the Manage vaccinations in schools service. Their background is white, but that appears to be the result of being on a white background rather than something that's explicitly set.

Screenshot 2024-11-26 at 12 40 48

secondary-buttons

@Tosin-Balogun
Copy link

@edwardhorsford

This was part of the point of making the background transparent, because it inherits whatever background it might sit on which increase its versatility. At the time, I was struggling a lot on screening to find the right level for different parts of the dashboard which was what made me create the original issue.

@edwardhorsford
Copy link
Contributor

@Tosin-Balogun perhaps it needs to be configurable? to set the background to solid or transparent?

In the example I shared the secondary couldn't be used in the filter area with grey background, etc.

Right now that is using a dark grey button:
Screenshot 2024-11-26 at 12 55 05

@Tosin-Balogun
Copy link

@edwardhorsford – I suppose there could be scope for customisation within your service. There should be room for service specific solutions

Our original backgrounds do not use that shade of grey, so it didn't factor into the thinking. On that grey background, our hyperlink won't work there either as the grey is more darker than ones we use for backgrounds.

Bit history here, our backgrounds used to be white originally, but we moved to the pale grey (which is a desaturated nhs blue actually) after lots of research we did to help reduce screen glare

Dean has an article about it somewhere on medium.

@benchilds
Copy link

Thanks for the open discussion @davidhunter08 @frankieroberto @edwardhorsford (and everyone else I've probably missed!) and explanation of the design approach @Tosin-Balogun. (Sorry for the delay replying... apparently I've not got notifications enabled for this repo).

  • I have worked primarily in NHS contexts (NHS BSA and NHS Digital > API Management) that might nominally be considered as web services rather than patient or citizen facing – think 'manage a thing', upload evidence, search and select multiple things, administrative tools, etc. I still feel there is an opportunity here to meet the common requirement to have a primary and secondary button adjacent to each other – and honestly, I don't think the solid green and bordered blue styles look very nice next to each other. The 'progression' from neutral to blue to green is a very helpful input (thanks @Tosin-Balogun) but I could argue the green bordered button still demonstrates this progression... it's just moved slightly into the green zone rather than sitting in the blue zone! :-)
  • I agree about the solid white bg potentially creating 'another primary' style... though I also think it would be a good optional attribute – and with guidance it should only be used to ensure the secondary style works in contexts where a solid bg is needed e.g. it should never be used in contexts where it is effectively an alternative primary style.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants