From 645912a7d4de60af103ae7a447960f7ce0990276 Mon Sep 17 00:00:00 2001 From: Barunes Padhy <148685909+barunespadhy@users.noreply.github.com> Date: Wed, 29 May 2024 16:00:50 +0300 Subject: [PATCH] Fixed an issue with Klaro autofocus Klaro loses its autofocus when the main page, into which Klaro has been loaded, focuses on one of its own elements. --- src/components/consent-notice.jsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/components/consent-notice.jsx b/src/components/consent-notice.jsx index a9226ac2..5665ef4a 100644 --- a/src/components/consent-notice.jsx +++ b/src/components/consent-notice.jsx @@ -13,6 +13,12 @@ export default class ConsentNotice extends React.Component { }; } + componentDidMount() { + if (this.props.config.autoFocus && this.noticeRef) { + this.noticeRef.focus() + } + } + componentDidUpdate(prevProps) { if (prevProps.modal !== this.props.modal) this.setState({ modal: this.props.modal });