@@ -242,29 +242,56 @@ const StepPopover = ({ highlightedElement, step, titleOption, actionButtons }: S
242242 [ highlightedElement ]
243243 ) ;
244244
245- return createPortal (
246- < div
247- className = {
248- `${ eccgui } -tooltip__content` +
249- ` ${ eccgui } -tooltip--${ step . size ?? "large" } ` +
250- ` ${ eccgui } -visual-tour__tooltip`
245+ const backdropRef = React . useCallback (
246+ ( backdrop : HTMLDivElement | null ) => {
247+ if ( backdrop ) {
248+ const targetRect = highlightedElement . getBoundingClientRect ( ) ;
249+ backdrop . style . left = `calc(${
250+ targetRect . left + window . scrollX + "px"
251+ } - var(--${ eccgui } -visual-tour-focus-padding))`;
252+ backdrop . style . top = `calc(${
253+ targetRect . top + window . scrollY + "px"
254+ } - var(--${ eccgui } -visual-tour-focus-padding))`;
255+ backdrop . style . width = `calc(${
256+ targetRect . width + "px"
257+ } + 2 * var(--${ eccgui } -visual-tour-focus-padding))`;
258+ backdrop . style . height = `calc(${
259+ targetRect . height + "px"
260+ } + 2 * var(--${ eccgui } -visual-tour-focus-padding))`;
251261 }
252- role = "tooltip"
253- ref = { tooltipRef }
254- >
255- < div id = "arrow" data-popper-arrow >
256- < span className = { `${ eccgui } -visual-tour__tooltip__arrow-shape` } />
262+ } ,
263+ [ highlightedElement ]
264+ ) ;
265+
266+ return createPortal (
267+ < div className = { `${ eccgui } -visual-tour` } >
268+ < div className = { `${ eccgui } -visual-tour__focushelper` } ref = { backdropRef } />
269+ < div >
270+ < div className = { `${ eccgui } -visual-tour__overlay` } />
271+ </ div >
272+ < div
273+ className = {
274+ `${ eccgui } -tooltip__content` +
275+ ` ${ eccgui } -tooltip--${ step . size ?? "large" } ` +
276+ ` ${ eccgui } -visual-tour__tooltip`
277+ }
278+ role = "tooltip"
279+ ref = { tooltipRef }
280+ >
281+ < div id = "arrow" data-popper-arrow >
282+ < span className = { `${ eccgui } -visual-tour__tooltip__arrow-shape` } />
283+ </ div >
284+ < Card >
285+ < CardHeader >
286+ < CardTitle > { step . title } </ CardTitle >
287+ < CardOptions > { titleOption } </ CardOptions >
288+ </ CardHeader >
289+ < CardContent >
290+ < StepContent step = { step } />
291+ </ CardContent >
292+ < CardActions inverseDirection > { actionButtons } </ CardActions >
293+ </ Card >
257294 </ div >
258- < Card >
259- < CardHeader >
260- < CardTitle > { step . title } </ CardTitle >
261- < CardOptions > { titleOption } </ CardOptions >
262- </ CardHeader >
263- < CardContent >
264- < StepContent step = { step } />
265- </ CardContent >
266- < CardActions inverseDirection > { actionButtons } </ CardActions >
267- </ Card >
268295 </ div > ,
269296 document . body
270297 ) ;
0 commit comments