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 text colors for hovered/selected elements and add adjacent text to checkbox icons #12213

Merged

Conversation

gcamacho079
Copy link
Contributor

@gcamacho079 gcamacho079 commented Oct 27, 2022

Description

Makes the following changes:

  • Adds a new mixin for updating the focus ring with custom colors
  • Updates the output for boolean custom field values to also include adjacent "Enabled" text. This fixes an issue of the icon not contrasting enough in the default/hover/selected element states (note: this is a solution that will likely need to be used for status icons as well).

Related issues

Resolves DEV-1034, DEV-962, DEV-546

@gcamacho079 gcamacho079 requested review from benjamindavid and a team as code owners October 27, 2022 17:18
@linear
Copy link

linear bot commented Oct 27, 2022

DEV-1034 The checkbox icon in lightswitch columns on index pages doesn't meet non-text contrast requirements

Page Area:

.checkbox-icon

Issue Description:

The contrast of the checkbox over the background is only 2.6:1

Action:

Darken so it's at least 3:1 over the background

Screenshot/Code Snippet:

.checkbox-icon::before {
  speak: none;
  -webkit-font-feature-settings: "liga","dlig";
  -ms-font-feature-settings: "liga","dlig";
  -o-font-feature-settings: "liga","dlig";
  font-feature-settings: "liga","dlig";
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  word-wrap: normal !important;
  color: var(--enabled-color);
  content: "check";
  direction: ltr;
  display: inline-block;
  font-family: Craft;
  font-size: 15px;
  font-style: normal;
  font-variant: normal;
  font-weight: 400;
  line-height: 1;
  line-height: var(--checkbox-size);
  opacity: var(--icon-opacity);
  text-align: center;
  text-transform: none;
  -webkit-user-select: none;
  user-select: none;
  vertical-align: middle;
}

Resolves CMS-276

@gcamacho079 gcamacho079 added the accessibility 👤 features related to accessibility label Oct 27, 2022
@linear
Copy link

linear bot commented Oct 27, 2022

DEV-962 "Remember your password?" and "Forgot your password?" buttons drop below 4.5:1 contrast on hover and focus

Page Area:

Login page

Issue Description:

When hovering/focused, the color drops below 4.5:1 against the background

Action:

Darken link on hover, or leave text color the same as when un-hovered

Screenshot/Code Snippet:

N/A

Resolves CMS-262

@linear
Copy link

linear bot commented Oct 27, 2022

DEV-546 Selected element in element tables has a background that is not 3:1 against adjacent, unselected elements

The background color of the cells in a selected element row is only 1.44:1 against the adjacent, unselected elements (#CDD8E4 against #FFFFFF)

Add an outline or darken the background color of cells to achieve at least 3:1 ratio against adjacent cells, or provide another visual indicator of selected state.

Screen Shot 2022-04-19 at 9.08.51 AM.png

Resolves CMS-190

…itch-columns

# Conflicts:
#	src/web/assets/cp/dist/css/cp.css
#	src/web/assets/cp/dist/css/cp.css.map
#	src/web/assets/graphiql/dist/css/graphiql.css.map
#	src/web/assets/installer/dist/css/install.css.map
#	src/web/assets/login/dist/css/login.css.map
#	src/web/assets/plugins/dist/css/PluginManager.css.map
#	src/web/assets/pluginstore/dist/css/app.css.map
#	src/web/assets/routes/dist/css/routes.css.map
#	src/web/assets/systemmessages/dist/css/system_messages.css.map
#	src/web/assets/updates/dist/css/UpdatesUtility.css.map
#	src/web/assets/upgrade/dist/css/UpgradeUtility.css.map
@brandonkelly
Copy link
Member

For DEV-1034, why can’t we just darken the checkmark color?

@gcamacho079
Copy link
Contributor Author

For DEV-1034, why can’t we just darken the checkmark color?

We certainly could. I was torn between this solution and just updating the color to ensure it's 3:1 against each background color; I think it would require a lighter green or white color in the "selected" state.

I opted for this solution to have some visual consistency between this and the status indicator change in this PR (i.e. an icon that doesn't change color based the element state, next to text that always meets the minimum contrast ratio for text).

@brandonkelly
Copy link
Member

Ah true, it would be good to stay consistent with the “enabled” green color. I’d be OK with a white checkbox over a green background, if that’s acceptable.

@brandonkelly
Copy link
Member

brandonkelly commented Jan 7, 2023

I don’t really care for the “Enabled” label since that doesn’t always make sense for the context. For example “Enabled” would be a confusing label for a Lightswitch field labeled “Featured entry?”. We could maybe add a setting for the “Enabled” label text, but if there’s a way to solve this without the label, I’d prefer that.

@gcamacho079
Copy link
Contributor Author

Ah true, it would be good to stay consistent with the “enabled” green color. I’d be OK with a white checkbox over a green background, if that’s acceptable.

Do you mean something along these lines?
In a cell with the column titled 'Show author email', there's a white checkbox icon that's enclosed in a medium green, rounded box.

This ensures that when the element row is selected and has a dark gray background, the white checkmark still remains visible over its green background:
The same checkbox icon, but over a dark gray background

If so, yes this is completely acceptable!

… for icon text alternative where there is one set
@gcamacho079
Copy link
Contributor Author

@brandonkelly, this is ready for review again. I’ve made the stylistic change and ensured the custom “On” label is used as the text alternative when there is one set.

…itch-columns

# Conflicts:
#	src/web/assets/cp/dist/css/cp.css
#	src/web/assets/cp/dist/css/cp.css.map
#	src/web/assets/craftsupport/dist/css/CraftSupportWidget.css.map
#	src/web/assets/dashboard/dist/css/Dashboard.css.map
#	src/web/assets/edittransform/dist/css/transforms.css.map
#	src/web/assets/edituser/dist/css/AccountSettingsForm.css.map
#	src/web/assets/edituser/dist/css/profile.css.map
#	src/web/assets/generalsettings/dist/css/rebrand.css.map
#	src/web/assets/graphiql/dist/css/graphiql.css.map
#	src/web/assets/installer/dist/css/install.css.map
#	src/web/assets/login/dist/css/login.css.map
#	src/web/assets/money/dist/css/Money.css.map
#	src/web/assets/plugins/dist/css/PluginManager.css.map
#	src/web/assets/pluginstore/dist/css/app.css.map
#	src/web/assets/pluginstore/dist/js/app.js
#	src/web/assets/pluginstore/dist/js/app.js.map
#	src/web/assets/pluginstoreoauth/dist/css/PluginStoreOauthCallback.css.map
#	src/web/assets/routes/dist/css/routes.css.map
#	src/web/assets/systemmessages/dist/css/system_messages.css.map
#	src/web/assets/updater/dist/css/Updater.css.map
#	src/web/assets/updates/dist/css/UpdatesUtility.css.map
#	src/web/assets/upgrade/dist/css/UpgradeUtility.css.map
#	src/web/assets/userpermissions/dist/css/UserPermissions.css.map
#	src/web/assets/utilities/dist/css/utilities.css.map
@brandonkelly
Copy link
Member

Lightened up the selected BG color a bit, to be consistent with the selected source item, the selected source path item (#12564), and hovered disclosure menu items.

@gcamacho079
Copy link
Contributor Author

@brandonkelly good call, the lighter color does indeed provide enough contrast!

…itch-columns

# Conflicts:
#	src/web/assets/cp/dist/css/cp.css
#	src/web/assets/cp/dist/css/cp.css.map
#	src/web/assets/pluginstore/dist/css/app.css.map
@brandonkelly brandonkelly merged commit ccc288c into 4.4 Feb 2, 2023
@brandonkelly brandonkelly deleted the feature/dev-1034-the-checkbox-icon-in-lightswitch-columns branch February 2, 2023 15:01
@brandonkelly
Copy link
Member

Sweet! Merged 🎉

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

Successfully merging this pull request may close these issues.

2 participants