File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,13 +19,22 @@ export class GalleryViewThumbnail extends Component {
1919 constructor ( props ) {
2020 super ( props ) ;
2121
22+ this . myRef = React . createRef ( ) ;
2223 this . state = { requestedAnnotations : false } ;
2324
2425 this . handleSelect = this . handleSelect . bind ( this ) ;
2526 this . handleKey = this . handleKey . bind ( this ) ;
2627 this . handleIntersection = this . handleIntersection . bind ( this ) ;
2728 }
2829
30+ // eslint-disable-next-line require-jsdoc
31+ componentDidMount ( ) {
32+ const { selected } = this . props ;
33+ if ( selected ) {
34+ this . myRef . current ?. scrollIntoView ( true ) ;
35+ }
36+ }
37+
2938 /** @private */
3039 handleSelect ( ) {
3140 const {
@@ -112,6 +121,7 @@ export class GalleryViewThumbnail extends Component {
112121 }
113122 onClick = { this . handleSelect }
114123 onKeyUp = { this . handleKey }
124+ ref = { this . myRef }
115125 role = "button"
116126 tabIndex = { 0 }
117127 >
You can’t perform that action at this time.
0 commit comments