Skip to content

Commit a5bebfc

Browse files
Jivika K IJivika K I
authored andcommitted
Fix: Add visible focus outlines for PDF viewer interactive elements
1 parent 1bada43 commit a5bebfc

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

web/viewer.css

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* See the License for the specific language governing permissions and
1313
* limitations under the License.
1414
*/
15-
15+
1616
@import url(pdf_viewer.css);
1717

1818
:root {
@@ -26,6 +26,7 @@
2626
--sidebar-transition-duration: 200ms;
2727
--sidebar-transition-timing-function: ease;
2828

29+
2930
--toolbar-height: 32px;
3031
--toolbar-horizontal-padding: 1px;
3132
--toolbar-vertical-padding: 2px;
@@ -35,6 +36,9 @@
3536
--doorhanger-icon-opacity: 0.9;
3637
--doorhanger-height: 8px;
3738

39+
/* Accessibility variable for focus rings */
40+
--focus-ring-outline: 2px solid #0a84ff;
41+
3842
--main-color: light-dark(rgb(12 12 13), rgb(249 249 250));
3943
--body-bg-color: light-dark(rgb(212 212 215), rgb(42 42 46));
4044
--progressBar-color: light-dark(rgb(10 132 255), rgb(0 96 223));
@@ -1058,8 +1062,28 @@ dialog :link {
10581062
height: auto;
10591063
}
10601064
}
1061-
}
1065+
/* ---- A11Y: strong keyboard focus ring for toolbar controls (WCAG 2.4.7) ---- */
1066+
.toolbarButton:focus-visible,
1067+
#secondaryToolbar .toolbarButton:focus-visible,
1068+
.toolbarField:focus-visible,
1069+
.dropdownToolbarButton:focus-visible,
1070+
.toolbarButtonWithContainer > .toolbarButton:focus-visible {
1071+
outline: var(--focus-ring-outline);
1072+
outline-offset: 2px;
1073+
box-shadow: none;
1074+
}
10621075

1076+
/* Windows High Contrast / Forced colors fallback */
1077+
@media (forced-colors: active) {
1078+
.toolbarButton:focus-visible,
1079+
#secondaryToolbar .toolbarButton:focus-visible,
1080+
.toolbarField:focus-visible,
1081+
.dropdownToolbarButton:focus-visible,
1082+
.toolbarButtonWithContainer > .toolbarButton:focus-visible {
1083+
outline: 2px solid CanvasText;
1084+
}
1085+
}
1086+
}
10631087
.toolbarButtonWithContainer {
10641088
height: 100%;
10651089
aspect-ratio: 1;

0 commit comments

Comments
 (0)