@@ -80,6 +80,7 @@ import type {
8080 ParsedDocSummary
8181} from '../../buildScripts/DataTypes.mjs'
8282import { logError } from '@instructure/console'
83+ import React from 'react'
8384
8485type AppContextType = {
8586 themeKey : keyof MainDocsData [ 'themes' ]
@@ -106,6 +107,7 @@ class App extends Component<AppProps, AppState> {
106107 _mediaQueryListener ?: ReturnType < typeof addMediaQueryMatchListener >
107108 _defaultDocumentTitle ?: string
108109 _controller ?: AbortController
110+ _heroRef : React . RefObject < Hero >
109111
110112 constructor ( props : AppProps ) {
111113 super ( props )
@@ -127,6 +129,8 @@ class App extends Component<AppProps, AppState> {
127129 versionsData : undefined ,
128130 iconsData : null
129131 }
132+
133+ this . _heroRef = React . createRef ( )
130134 }
131135
132136 fetchDocumentData = async ( docId : string ) => {
@@ -487,6 +491,7 @@ class App extends Component<AppProps, AppState> {
487491 repository = { library . repository }
488492 version = { library . version }
489493 layout = { layout }
494+ ref = { this . _heroRef }
490495 />
491496 </ InstUISettingsProvider >
492497 )
@@ -691,6 +696,10 @@ class App extends Component<AppProps, AppState> {
691696 ) : null
692697 }
693698
699+ focusMainContent = ( ) => {
700+ this . _heroRef . current ?. focusMainContentHeading ( )
701+ }
702+
694703 render ( ) {
695704 const key = this . state . key
696705 const { showMenu, layout, docsData, iconsData } = this . state
@@ -717,6 +726,18 @@ class App extends Component<AppProps, AppState> {
717726 aria-label = { key || docsData . library . name }
718727 ref = { this . handleContentRef }
719728 >
729+ < View
730+ as = { 'button' }
731+ onClick = { this . focusMainContent }
732+ tabIndex = { 0 }
733+ css = { this . props . styles ?. skipToMainButton }
734+ borderRadius = "small"
735+ display = "inline-block"
736+ padding = "small"
737+ background = "primary"
738+ >
739+ Skip to main content
740+ </ View >
720741 { ! showMenu && (
721742 < div css = { this . props . styles ?. hamburger } >
722743 < InstUISettingsProvider >
0 commit comments