Skip to content

Commit

Permalink
Administration: Accessibility: Use the default cursor style for label…
Browse files Browse the repository at this point in the history
…s and disabled form controls.

The native cursor style for labels and form controls is `default`, which is the platform-dependent default cursor. Typically an arrow. Historically, WordPress always used the `pointer` style for all form controls and labels. While this isn't standard, there is some value in using the `pointer` style for form controls. However, labels should use the default style especially when the associated controls are disabled.
Additionally, makes sure the disabled styling works for form controls with an `aria-disabled="true"` attribute.

Props joedolson, afercia.
Fixes #59733.


git-svn-id: https://develop.svn.wordpress.org/trunk@57520 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
afercia committed Feb 2, 2024
1 parent 88bcfb7 commit 50215df
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
15 changes: 10 additions & 5 deletions src/wp-admin/css/forms.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ textarea {
resize: vertical;
}

label {
cursor: pointer;
}

input,
select {
margin: 0 1px;
Expand Down Expand Up @@ -287,22 +283,27 @@ textarea.disabled {

input[type="file"]:disabled,
input[type="file"].disabled,
input[type="file"][aria-disabled="true"],
input[type="range"]:disabled,
input[type="range"].disabled {
input[type="range"].disabled,
input[type="range"][aria-disabled="true"] {
background: none;
box-shadow: none;
cursor: default;
}

input[type="checkbox"]:disabled,
input[type="checkbox"].disabled,
input[type="checkbox"][aria-disabled="true"],
input[type="radio"]:disabled,
input[type="radio"].disabled,
input[type="radio"][aria-disabled="true"],
input[type="checkbox"]:disabled:checked:before,
input[type="checkbox"].disabled:checked:before,
input[type="radio"]:disabled:checked:before,
input[type="radio"].disabled:checked:before {
opacity: 0.7;
cursor: default;
}

/*------------------------------------------------------------------------------
Expand Down Expand Up @@ -356,6 +357,10 @@ input[type="radio"].disabled:checked:before {
transform: none;
}

.wp-core-ui select[aria-disabled="true"] {
cursor: default;
}

/* Reset Firefox inner outline that appears on :focus. */
/* This ruleset overrides the color change on :focus thus needs to be after select:focus. */
.wp-core-ui select:-moz-focusring {
Expand Down
4 changes: 0 additions & 4 deletions src/wp-admin/css/install.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,6 @@ fieldset {
margin: 0;
}

label {
cursor: pointer;
}

#logo {
margin: -130px auto 25px;
padding: 0 0 25px;
Expand Down
9 changes: 9 additions & 0 deletions src/wp-includes/css/buttons.css
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,11 @@ TABLE OF CONTENTS:
transform: none !important;
}

.wp-core-ui .button[aria-disabled="true"],
.wp-core-ui .button-secondary[aria-disabled="true"] {
cursor: default;
}

/* Buttons that look like links, for a cross of good semantics with the visual */
.wp-core-ui .button-link {
margin: 0;
Expand Down Expand Up @@ -283,6 +288,10 @@ TABLE OF CONTENTS:
cursor: default;
}

.wp-core-ui .button-primary[aria-disabled="true"] {
cursor: default;
}

/* ----------------------------------------------------------------------------
4.0 - Button Groups
---------------------------------------------------------------------------- */
Expand Down

0 comments on commit 50215df

Please sign in to comment.