You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are trying to use SkipLink with its default behaviour, but it does not seem to work unless it is rendered after the target is rendered.
The intention is to include SkipLink in a layout that will wrap every page. We want the 'select the first h1' behaviour rather than customising the target.
This does not seem to work:
functionSomeComponent(){// does something that causes this component to re-renderreturn<h1>Get selected</h1>}functionApp(){return(<div><SkipLinkdisableDefaultBehaviour/><SomeComponent/></div>)}
I believe that this does not work because SkipLink only searches for a target when it renders; rather than searching in the onClick handler.
I am suggesting moving the call to getFirstHeadingElement(); inside focusTarget.
I am unsure if this is related this minimalist issue: #242.
It might also be possible to simplify focusing the target by using element.focus() rather than adding tabIndex. This would make it easier to remove the useEffect.
Does this seem like a bug to you? We could consider drafting a PR.
The text was updated successfully, but these errors were encountered:
We are trying to use SkipLink with its default behaviour, but it does not seem to work unless it is rendered after the target is rendered.
The intention is to include SkipLink in a layout that will wrap every page. We want the 'select the first h1' behaviour rather than customising the target.
This does not seem to work:
I believe that this does not work because SkipLink only searches for a target when it renders; rather than searching in the onClick handler.
I am suggesting moving the call to
getFirstHeadingElement();
insidefocusTarget
.I am unsure if this is related this minimalist issue: #242.
It might also be possible to simplify focusing the target by using
element.focus()
rather than adding tabIndex. This would make it easier to remove theuseEffect
.Does this seem like a bug to you? We could consider drafting a PR.
The text was updated successfully, but these errors were encountered: