Skip to content

Comments

Darken input borders to meet minimum contrast for UI components#12313

Open
gcamacho079 wants to merge 14 commits into5.xfrom
a11y/dev-515
Open

Darken input borders to meet minimum contrast for UI components#12313
gcamacho079 wants to merge 14 commits into5.xfrom
a11y/dev-515

Conversation

@gcamacho079
Copy link
Contributor

@gcamacho079 gcamacho079 commented Nov 14, 2022

Description

Inputs (text, radio, checkbox, etc.) should meet 3:1 color contrast against page background per 1.4.11: Non-Text Contrast. This PR introduces a new CSS variables for input border and input border color to manage field borders throughout the control panel.

Related issues

Resolves DEV-515, DEV-322, DEV-317

@gcamacho079 gcamacho079 requested review from a team and benjamindavid as code owners November 14, 2022 23:48
@linear
Copy link

linear bot commented Nov 14, 2022

DEV-515 Radio button and checkbox field borders have insufficient contrast against background

The border for these elements is under 2:1 against the white form background

These element borders should be darkened so that they meet the 3:1 contrast ratio prescribed for user interface components

Screen Shot 2022-04-18 at 12.16.37 PM.png

Resolves CMS-162

DEV-322 Text inputs without placeholder text do not have a high enough contrast ratio against the background

Screen Shot 2022-03-14 at 3.19.04 PM.png

When text inputs do not have placeholder text, their borders do not meet contrast requirements for non-text content. The current contrast ratio is 1.58:1 on white backgrounds, and 1.24:1 on the global gray background.

The color should be changed to a blue of #688aac to be a dark enough outline on all backgrounds.

Resolves CMS-041

DEV-317 "Keep me logged in" checkbox doesn't meet minimum contrast guidelines

The contrast of the checkbox outline against the page background is 1.74:1. This should be darkened to achieve a contrast ratio of 3:1 for graphical user interface components

CMS-038

@gcamacho079 gcamacho079 added accessibility 👤 features related to accessibility ui 👀 features related to the control panel UI labels Nov 15, 2022
# 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/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 brandonkelly changed the base branch from 4.4 to 5.0 January 10, 2023 00:07
@brandonkelly
Copy link
Member

That feels really harsh to my eyes. Would it be OK to only do this for prefers-contrast? Otherwise, maybe via a new accessibility preference?

@gcamacho079
Copy link
Contributor Author

gcamacho079 commented Jan 10, 2023

That feels really harsh to my eyes. Would it be OK to only do this for prefers-contrast? Otherwise, maybe via a new accessibility preference?

After some additional research, a new accessibility preference sounds like a good idea for this change, as high contrast modes can have usability implications for some users. However, we do have to ensure that the path to enable this setting does meet minimum contrast requirements. This path includes:

  1. Login page
  2. Opening the My Account menu
  3. Clicking the link to go to preferences
  4. Going to the Preferences tab
  5. Enabling the high contrast setting

I like your idea of having a preference versus using prefers-contrast as some users might not even know how to change their contrast settings, and browser support could be variable.

I’ve created #12517 to ensure the Account menu meets the minimum contrast for UI components; however, if we’re using a checkbox-style option (i.e., “Enable high contrast mode”), checkbox borders would still need to be darkened. Thoughts?

@brandonkelly
Copy link
Member

Think this goes back to coming up with some sort of account setup wizard, which could be presented to users when they first log into the control panel, which presents them with all the accessibility preferences. Accounts can default to having any relevant accessibility settings enabled by default to ensure the wizard meets the necessary criteria.

@brandonkelly
Copy link
Member

So for the purposes of this PR, let’s just add the preference and not worry about whether the screens leading up to it are compliant.

@gcamacho079
Copy link
Contributor Author

@brandonkelly user preference added! For simplicity, I reverted some changes to remove the extra --input-border variable. I thought having too many stylistic/layout changes tied to the higher contrast view might be difficult to maintain, so I retained the changes I made in the .meta container for all users, so there’s now a faint border around (and spacing between) inputs in this area for low-contrast users.

@gcamacho079
Copy link
Contributor Author

@brandonkelly I was revisiting this PR about disabled element contrast inside indexes. I wonder if this “Increase contrast” setting would be a good candidate for looping in the "disabled elements get italicized text” update. To clarify, we can create some accessibility documentation in the docs that outline all the UI changes bundled with that user setting; this would also help us achieve the ATAG requirement for documenting accessibility features.

@brandonkelly brandonkelly changed the base branch from 5.0 to 5.x March 26, 2024 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

accessibility 👤 features related to accessibility ui 👀 features related to the control panel UI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants