rust/tests/rustdoc-gui/skip-navigation.goml
ThanhNguyxn 78afe876f4 Add 'Skip to main content' link for keyboard navigation in rustdoc
Implements WCAG 2.4.1 (Level A) - Bypass Blocks accessibility feature.

Changes:
- Add skip-main-content link in page.html with tabindex=-1 on main-content
- Add CSS styling per reviewer feedback (outline border, themed colors)
- Add GOML test for skip navigation functionality

Fixes #151420
2026-01-23 18:19:00 +07:00

19 lines
787 B
Text

// This test ensures that the "Skip to main content" link works correctly
// for keyboard navigation (WCAG 2.4.1 compliance).
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
// The skip link should be hidden initially (positioned off-screen above viewport)
store-position: (".skip-main-content", {"y": y_before})
store-size: (".skip-main-content", {"height": height_before})
assert: |y_before| + |height_before| < 0
// The skip link should be the first focusable element when pressing Tab
press-key: "Tab"
wait-for: ".skip-main-content:focus"
// When focused, the link should be visible (top: 0px)
assert-css: (".skip-main-content:focus", {"top": "0px"})
// Pressing Enter on the skip link should move focus to main content
press-key: "Enter"
wait-for: "#main-content:focus"