Skip to content

Commit

Permalink
Merge pull request #2101 from GSA/2065-fix-skip-to-h1-tab-order
Browse files Browse the repository at this point in the history
PXBF-2065-fix-skip-to-h1-tab-order: update name space
  • Loading branch information
scottqueen-bixal authored Feb 6, 2025
2 parents 318ab71 + 6aab396 commit b88db8f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion benefit-finder/cypress/e2e/storybook/axe-a11y.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe(`Validate code passes axe scanning`, () => {
// go to first step
it('Has no detectable a11y violations on step 1', () => {
cy.clickButton(EN_LOCALE_DATA.intro.button)
cy.wait(2500)
cy.wait(2500) // eslint-disable-line cypress/no-unnecessary-waiting
runA11y()
})

Expand Down
3 changes: 1 addition & 2 deletions benefit-finder/src/Routes/LifeEventSection/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ const LifeEventSection = ({ data, handleData, ui }) => {
const locale = apiCalls.GET.Language()

let location = useLocation() // ignore prefer-const

useScrollToAnchor(location)

/**
Expand Down Expand Up @@ -273,7 +272,7 @@ const LifeEventSection = ({ data, handleData, ui }) => {
a11yTitles(location.pathname, locale)
!location.hash && resetElement.current?.focus()
!location.hash && window.scrollTo(0, 0)
setHasError([]) // reset error state
!location.hash && setHasError([]) // reset error state
}, [location])

useEffect(() => {
Expand Down
4 changes: 2 additions & 2 deletions benefit-finder/src/shared/hooks/useScrollToAnchor/index.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useEffect, useRef } from 'react'

function ScrollToAnchor({ location, offset }) {
function useScrollToAnchor({ location, offset }) {
const lastHash = useRef('')

// listen to location change using useEffect with location as dependency
Expand All @@ -24,4 +24,4 @@ function ScrollToAnchor({ location, offset }) {
return null
}

export default ScrollToAnchor
export default useScrollToAnchor

0 comments on commit b88db8f

Please sign in to comment.