File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
src/webviews/apps/plus/composer/components Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -488,7 +488,23 @@ export class CommitsPanel extends LitElement {
488488 const commitItem = this . shadowRoot ?. querySelector (
489489 `gl-commit-item[data-commit-id="${ firstNonLockedCommit . id } "]` ,
490490 ) ;
491- commitItem ?. scrollIntoView ( { block : 'center' } ) ;
491+ if ( ! commitItem ) return ;
492+
493+ const container = this . shadowRoot ?. querySelector ( '.container.scrollable' ) ;
494+ if ( ! container ) {
495+ commitItem . scrollIntoView ( { block : 'center' } ) ;
496+ return ;
497+ }
498+
499+ const itemRect = commitItem . getBoundingClientRect ( ) ;
500+ const containerRect = container . getBoundingClientRect ( ) ;
501+ const itemTop = itemRect . top - containerRect . top + container . scrollTop ;
502+ const targetPosition = itemTop - containerRect . height * 0.1 ;
503+
504+ container . scrollTo ( {
505+ top : Math . max ( 0 , targetPosition ) ,
506+ behavior : 'smooth' ,
507+ } ) ;
492508 } ) ;
493509 }
494510
You can’t perform that action at this time.
0 commit comments