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

Selected color not highlighted in entry page #72

Closed
arlingga opened this issue Nov 9, 2021 · 5 comments
Closed

Selected color not highlighted in entry page #72

arlingga opened this issue Nov 9, 2021 · 5 comments
Labels
bug Something isn't working status: complete

Comments

@arlingga
Copy link

arlingga commented Nov 9, 2021

Hi guys, this is a great and helpful plugin, thank you for making it real!

We are currently running on Craft CMS 3.7.18 and Craft Colour Swatches 1.4.2. It is working great, however when we select a color in the entry page, the selected color seems like losing its focus. The selected ring/shadow around the color is missing.

Screenshot 2021-11-09 at 11 14 17

arlingga pushed a commit to arlingga/craft-colour-swatches that referenced this issue Nov 9, 2021
@arlingga
Copy link
Author

arlingga commented Nov 9, 2021

Sorry guys, turns out it was nothing to do with the plugins, it was Craft CMS issue and already resolved by Craft CMS 3.7.18.1. Can close this one. Cheers!

@arlingga arlingga closed this as completed Nov 9, 2021
@mtnorthrop
Copy link

Would it be possible to re-open this issue? The bug described here actually still exists as of Craft CMS 3.7.20.

The problem is this code in Craft's stylesheets (src/web/assets/cp/src/css/_cp.scss):

.reduce-focus-visibility {
  :focus:not(.focus-visible) {
    box-shadow: none;
  }

  .focus-visible {
    box-shadow: $darkFocusRing;
  }
}

This is setting box-shadow: none; at a higher specificity than Color Swatches' rule in ColourSwatches.css:

.color-swatches button.active {
    box-shadow: 0 0 0 3px #F2842D;
}

I would suggest finding a different way of highlighting the selected option, since it seems that Craft has taken over the box-shadow property of form fields. Maybe we could use the ::after pseudo element, or choose a different way of indicating the selected color option?

@circa1983
Copy link

Looking at the css a quick fix would be to update ColourSwatches.css and change line 58 from: .color-swatches button.active { to

.reduce-focus-visibility .color-swatches button.active,
.color-swatches button.active {

I realise this isn’t the most eligate solution and long term the @mtnorthrop ’s suggestion of using a pseudo element, or choose a different way of indicating the selected color option would be more appropriate

@michtio
Copy link
Contributor

michtio commented Nov 17, 2021

I am currently going to use the quick fix in specificity that @circa1983 suggested @mtnorthrop

A more robust / better solution will be go out in a next release right before our x-mas break, so I will leave this issue open for the time being.

@michtio
Copy link
Contributor

michtio commented Nov 17, 2021

This quick and dirty fix has been released:

https://github.com/percipioglobal/craft-colour-swatches/releases/tag/1.4.2.1

@michtio michtio added the bug Something isn't working label Nov 24, 2021
@michtio michtio closed this as completed Dec 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working status: complete
Projects
None yet
Development

No branches or pull requests

5 participants