File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
dotcom-rendering/src/components/marketing/banners/designableBanner Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ import type {
23
23
Image ,
24
24
} from '@guardian/support-dotcom-components/dist/shared/types' ;
25
25
import type { ChoiceCard } from '@guardian/support-dotcom-components/dist/shared/types/props/choiceCards' ;
26
- import { useEffect , useState } from 'react' ;
26
+ import { useEffect , useRef , useState } from 'react' ;
27
27
import {
28
28
removeMediaRulePrefix ,
29
29
useMatchMedia ,
@@ -137,6 +137,17 @@ const DesignableBanner: ReactComponent<BannerRenderProps> = ({
137
137
) ;
138
138
} , [ ] ) ;
139
139
140
+ const bannerRef = useRef < HTMLDivElement > ( null ) ;
141
+
142
+ useEffect ( ( ) => {
143
+ const firstInteractiveChoiceCard = bannerRef . current ?. querySelector (
144
+ 'input' ,
145
+ ) as HTMLElement | null ;
146
+ if ( firstInteractiveChoiceCard ) {
147
+ firstInteractiveChoiceCard . focus ( ) ;
148
+ }
149
+ } , [ ] ) ;
150
+
140
151
useEffect ( ( ) => {
141
152
if ( iosAppBannerPresent ) {
142
153
// send ophan event
@@ -275,6 +286,9 @@ const DesignableBanner: ReactComponent<BannerRenderProps> = ({
275
286
276
287
return (
277
288
< div
289
+ ref = { bannerRef }
290
+ role = "alert"
291
+ tabIndex = { - 1 }
278
292
css = { styles . outerContainer (
279
293
templateSettings . containerSettings . backgroundColour ,
280
294
iosAppBannerPresent ,
You can’t perform that action at this time.
0 commit comments