File tree Expand file tree Collapse file tree
packages/app-backend-core/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -357,11 +357,31 @@ function connectBridge () {
357357 if ( instance ) {
358358 const [ el ] = await ctx . api . getComponentRootElements ( instance )
359359 if ( el ) {
360- el . scrollIntoView ( {
361- behavior : 'smooth' ,
362- block : 'center' ,
363- inline : 'center'
364- } )
360+ if ( typeof el . scrollIntoView === 'function' ) {
361+ el . scrollIntoView ( {
362+ behavior : 'smooth' ,
363+ block : 'center' ,
364+ inline : 'center'
365+ } )
366+ } else {
367+ // Handle nodes that don't implement scrollIntoView
368+ const bounds = await ctx . api . getComponentBounds ( instance )
369+ const scrollTarget = document . createElement ( 'div' )
370+ scrollTarget . style . position = 'absolute'
371+ scrollTarget . style . width = `${ bounds . width } px`
372+ scrollTarget . style . height = `${ bounds . height } px`
373+ scrollTarget . style . top = `${ bounds . top } px`
374+ scrollTarget . style . left = `${ bounds . left } px`
375+ document . body . appendChild ( scrollTarget )
376+ scrollTarget . scrollIntoView ( {
377+ behavior : 'smooth' ,
378+ block : 'center' ,
379+ inline : 'center'
380+ } )
381+ setTimeout ( ( ) => {
382+ document . body . removeChild ( scrollTarget )
383+ } , 2000 )
384+ }
365385 highlight ( instance , ctx )
366386 setTimeout ( ( ) => {
367387 unHighlight ( )
You can’t perform that action at this time.
0 commit comments