(canon)fix: Add cursor styling for TextField label.

Signed-off-by: Johan Persson <johanopersson@gmail.com>
This commit is contained in:
Johan Persson
2025-04-28 11:07:53 +02:00
parent 720033cd26
commit ab02af7802
6 changed files with 27 additions and 2 deletions
+1 -1
View File
@@ -2,4 +2,4 @@
'@backstage/canon': patch
---
For improved a11y, clicking a Select component label now focuses the Select trigger element.
For improved a11y, clicking a Select component label now focuses the Select trigger element, and the TextField component's label is now styled to indicate it's interactive.
+5
View File
@@ -543,6 +543,11 @@
font-weight: var(--canon-font-weight-regular);
color: var(--canon-fg-primary);
margin-bottom: var(--canon-space-1_5);
cursor: pointer;
}
.canon-TextFieldLabel[data-disabled] {
cursor: default;
}
.canon-TextFieldDescription {
+5
View File
@@ -9767,6 +9767,11 @@
font-weight: var(--canon-font-weight-regular);
color: var(--canon-fg-primary);
margin-bottom: var(--canon-space-1_5);
cursor: pointer;
}
.canon-TextFieldLabel[data-disabled] {
cursor: default;
}
.canon-TextFieldDescription {
+5
View File
@@ -10,6 +10,11 @@
font-weight: var(--canon-font-weight-regular);
color: var(--canon-fg-primary);
margin-bottom: var(--canon-space-1_5);
cursor: pointer;
}
.canon-TextFieldLabel[data-disabled] {
cursor: default;
}
.canon-TextFieldDescription {
@@ -26,6 +26,10 @@
font-weight: var(--canon-font-weight-regular);
color: var(--canon-fg-primary);
margin-bottom: var(--canon-space-1_5);
cursor: pointer;
}
.canon-TextFieldLabel[data-disabled] {
cursor: default;
}
.canon-TextFieldDescription {
@@ -32,6 +32,7 @@ export const TextField = forwardRef<HTMLDivElement, TextFieldProps>(
error,
required,
style,
disabled,
...rest
} = props;
@@ -50,7 +51,11 @@ export const TextField = forwardRef<HTMLDivElement, TextFieldProps>(
ref={ref}
>
{label && (
<label className="canon-TextFieldLabel" htmlFor={inputId}>
<label
className="canon-TextFieldLabel"
htmlFor={inputId}
data-disabled={disabled}
>
{label}
{required && (
<span aria-hidden="true" className="canon-TextFieldRequired">
@@ -70,6 +75,7 @@ export const TextField = forwardRef<HTMLDivElement, TextFieldProps>(
})}
data-invalid={error}
required={required}
disabled={disabled}
{...rest}
/>
{description && (