Skip to content
Snippets Groups Projects
Unverified Commit 17f3fce2 authored by priyamanalil's avatar priyamanalil Committed by GitHub
Browse files

Scroll the selected image to view in Gallery (#3530)

parent 338fb8b6
No related branches found
No related tags found
No related merge requests found
...@@ -19,6 +19,7 @@ export class GalleryViewThumbnail extends Component { ...@@ -19,6 +19,7 @@ export class GalleryViewThumbnail extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.myRef = React.createRef();
this.state = { requestedAnnotations: false }; this.state = { requestedAnnotations: false };
this.handleSelect = this.handleSelect.bind(this); this.handleSelect = this.handleSelect.bind(this);
...@@ -26,6 +27,14 @@ export class GalleryViewThumbnail extends Component { ...@@ -26,6 +27,14 @@ export class GalleryViewThumbnail extends Component {
this.handleIntersection = this.handleIntersection.bind(this); this.handleIntersection = this.handleIntersection.bind(this);
} }
// eslint-disable-next-line require-jsdoc
componentDidMount() {
const { selected } = this.props;
if (selected) {
this.myRef.current?.scrollIntoView(true);
}
}
/** @private */ /** @private */
handleSelect() { handleSelect() {
const { const {
...@@ -112,6 +121,7 @@ export class GalleryViewThumbnail extends Component { ...@@ -112,6 +121,7 @@ export class GalleryViewThumbnail extends Component {
} }
onClick={this.handleSelect} onClick={this.handleSelect}
onKeyUp={this.handleKey} onKeyUp={this.handleKey}
ref={this.myRef}
role="button" role="button"
tabIndex={0} tabIndex={0}
> >
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment