This repository was archived by the owner on Oct 1, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +6
-7
lines changed
Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Original file line number Diff line number Diff line change 1- import React , { createRef , useState , useEffect } from "react"
1+ import React , { useRef , useState , useEffect } from "react"
22import { withLastLocation } from "react-router-last-location"
33import PropTypes from "prop-types"
44
55import { FOCUSABLE_TABINDEX , UNFOCUSABLE_TABINDEX } from "./constants"
66
77const PageHeader = props => {
88 const [ tabIndex , setTabIndex ] = useState ( FOCUSABLE_TABINDEX )
9- const headerRef = createRef ( )
9+ const headerRef = useRef ( null )
1010
1111 useEffect ( ( ) => {
1212 if ( props . lastLocation ) {
Original file line number Diff line number Diff line change @@ -14,12 +14,14 @@ import "./styles.scss"
1414import { FOCUSABLE_TABINDEX , UNFOCUSABLE_TABINDEX } from "./constants"
1515
1616export default function Main ( ) {
17+ const headerRef = React . useRef ( null )
18+ const mainRef = React . useRef ( null )
1719 const Attributes = {
1820 TABINDEX : "tabindex" ,
1921 }
22+ const getHeaderTabIndex = ( ) => headerRef . current . getAttribute ( Attributes . TABINDEX )
23+ const getMainTabIndex = ( ) => mainRef . current . getAttribute ( Attributes . TABINDEX )
2024
21- const headerRef = React . createRef ( )
22- const mainRef = React . createRef ( )
2325 const componentUnmountFunction = ( ) => {
2426 ContextUtil . disableFocusOutline ( )
2527 }
@@ -34,9 +36,6 @@ export default function Main() {
3436 ref . current . focus ( )
3537 }
3638
37- const getHeaderTabIndex = ( ) => headerRef . current . getAttribute ( Attributes . TABINDEX )
38- const getMainTabIndex = ( ) => mainRef . current . getAttribute ( Attributes . TABINDEX )
39-
4039 const handleHeaderBlur = ( ) => {
4140 if ( getHeaderTabIndex ( ) === UNFOCUSABLE_TABINDEX ) return
4241 headerRef . current . removeAttribute ( Attributes . TABINDEX )
You can’t perform that action at this time.
0 commit comments