fix(ui): show text field and line comment focus in high contrast mode (#65100)

This commit is contained in:
usrnk1
2026-11-20 10:48:19 +01:00
committed by GitHub
Unverified
parent f00f28ded2
commit 10e26d9d6c
7 changed files with 72 additions and 9 deletions
@@ -1,7 +1,13 @@
[data-component="timeline-search-bar"] [data-component="text-input-v2"] {
background: var(--v2-background-bg-base);
box-shadow: inset 0 0 0 1px var(--v2-border-border-base);
outline: none;
}
/* The focus state here is an inset shadow, which forced colours remove, so leave the field's own ring alone there. */
@media (forced-colors: none) {
[data-component="timeline-search-bar"] [data-component="text-input-v2"] {
outline: none;
}
}
[data-component="timeline-search-bar"] [data-component="text-input-v2"]:hover {
@@ -10,5 +16,4 @@
[data-component="timeline-search-bar"] [data-component="text-input-v2"]:focus-within {
box-shadow: inset 0 0 0 1px var(--v2-border-border-focus);
outline: none;
}
+6 -1
View File
@@ -8,7 +8,6 @@
height: 36px;
padding-inline-end: 12px;
border-radius: 6px;
outline: 0;
background: color-mix(in srgb, var(--v2-background-bg-layer-02) 60%, transparent);
box-shadow: none;
transition:
@@ -22,6 +21,12 @@
box-shadow: none;
}
@media (forced-colors: none) {
.palette-menu-search [data-component="text-input-v2"] {
outline: 0;
}
}
.palette-menu-search [data-slot="text-input-v2-value"] {
border-radius: 6px;
background: transparent;
+7 -1
View File
@@ -340,11 +340,17 @@
[data-component="text-input-v2"],
[data-component="text-input-v2"]:where(:hover, :focus-within):not([data-disabled], [data-invalid]) {
border-radius: 0;
outline: 0;
background: transparent;
box-shadow: none;
}
@media (forced-colors: none) {
[data-component="text-input-v2"],
[data-component="text-input-v2"]:where(:hover, :focus-within):not([data-disabled], [data-invalid]) {
outline: 0;
}
}
[data-slot="text-input-v2-value"] {
gap: 8px;
}
@@ -169,9 +169,11 @@ export const lineCommentStyles = `
line-height: var(--line-height-large);
}
/* An outline, not a shadow: forced colours drop shadows, and the outline outside the border still marks focus there. */
[data-component="line-comment"] [data-slot="line-comment-textarea"]:focus {
outline: none;
box-shadow: var(--shadow-xs-border-select);
border-color: var(--v2-border-border-focus);
outline: 1px solid var(--v2-border-border-focus);
outline-offset: 0;
}
[data-component="line-comment"] [data-slot="line-comment-mention-list"] {
@@ -16,7 +16,6 @@
height: 36px;
padding-inline-end: 12px;
border-radius: 6px;
outline: 0;
background: color-mix(in srgb, var(--v2-background-bg-layer-02) 60%, transparent);
box-shadow: none;
transition:
@@ -29,6 +28,12 @@
box-shadow: none;
}
@media (forced-colors: none) {
[data-component="text-input-v2"] {
outline: 0;
}
}
[data-slot="text-input-v2-value"] {
gap: 8px;
border-radius: 6px;
@@ -22,7 +22,6 @@
align-self: stretch;
transition:
background 85ms ease-out,
outline-color 85ms ease-out,
box-shadow 85ms ease-out;
}
@@ -206,4 +205,25 @@
color: var(--v2-state-fg-danger);
opacity: 1;
}
/*
Forced colours remove the shadow that draws the field's edge and turn every outline the same system colour, so rest,
focus and invalid looked identical. The edge becomes a border (dashed when invalid) and focus gets the shared ring.
*/
@media (forced-colors: active) {
[data-component="text-input-v2"] {
border: 1px solid CanvasText;
outline: none;
}
[data-component="text-input-v2"]:where([data-invalid]):not([data-disabled]) {
border: 2px dashed CanvasText;
outline: none;
}
[data-component="text-input-v2"]:focus-within:not([data-disabled]) {
outline: 2px solid Highlight;
outline-offset: 2px;
}
}
}
+21 -1
View File
@@ -16,7 +16,6 @@
align-self: stretch;
transition:
background 85ms ease-out,
outline-color 85ms ease-out,
box-shadow 85ms ease-out;
}
@@ -81,3 +80,24 @@
color: var(--v2-state-fg-danger);
opacity: 1;
}
/*
Forced colours remove the shadow that draws the field's edge and turn every outline the same system colour, so rest,
focus and invalid looked identical. The edge becomes a border (dashed when invalid) and focus gets the shared ring.
*/
@media (forced-colors: active) {
[data-component="textarea-v2"] {
border: 1px solid CanvasText;
outline: none;
}
[data-component="textarea-v2"]:where([data-invalid]):not([data-disabled]) {
border: 2px dashed CanvasText;
outline: none;
}
[data-component="textarea-v2"]:focus-within:not([data-disabled]) {
outline: 2px solid Highlight;
outline-offset: 2px;
}
}