Fix jump to content (#2729)

This commit is contained in:
SleeplessOne1917 2024-10-01 03:00:54 +00:00 committed by GitHub
parent 7be8d1d8eb
commit 8a500f3ddf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -16,13 +16,15 @@ import AnonymousGuard from "../common/anonymous-guard";
import AdultConsentModal from "../common/modal/adult-consent-modal"; import AdultConsentModal from "../common/modal/adult-consent-modal";
import { destroyTippy, setupTippy } from "../../tippy"; import { destroyTippy, setupTippy } from "../../tippy";
function handleJumpToContent(event) { function handleJumpToContent(app: App, event: any) {
event.preventDefault(); event.preventDefault();
app.contentRef.current?.focus();
} }
export default class App extends Component<any, any> { export default class App extends Component<any, any> {
private isoData: IsoDataOptionalSite = setIsoData(this.context); private isoData: IsoDataOptionalSite = setIsoData(this.context);
private readonly rootRef = createRef<HTMLDivElement>(); private readonly rootRef = createRef<HTMLDivElement>();
readonly contentRef = createRef<HTMLDivElement>();
componentDidMount() { componentDidMount() {
setupTippy(this.rootRef); setupTippy(this.rootRef);
@ -69,7 +71,7 @@ export default class App extends Component<any, any> {
return ( return (
<ErrorGuard> <ErrorGuard>
<div tabIndex={-1}> <div tabIndex={-1} ref={this.contentRef}>
{RouteComponent && {RouteComponent &&
(isAuthPath(path ?? "") ? ( (isAuthPath(path ?? "") ? (
<AuthGuard {...routeProps}> <AuthGuard {...routeProps}>