Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/components/ThumbnailCanvasGrouping.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ export class ThumbnailCanvasGrouping extends PureComponent {
role="button"
data-canvas-id={currentGroupings[0].id}
data-canvas-index={currentGroupings[0].index}
onKeyUp={this.setCanvas}
onClick={this.setCanvas}
tabIndex={-1}
sx={theme => ({
Expand Down
11 changes: 11 additions & 0 deletions src/components/ThumbnailNavigation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@ export function ThumbnailNavigation({
gridRef.current?.scrollToItem(index, 'center');
}, [canvasIndex, view]);

// Prevent loss of focus when navigating thumbnails
const paperRef = useRef(null);

useEffect(() => {
if (paperRef.current && document.activeElement !== paperRef.current) {
paperRef.current.focus();
}
}, [canvasIndex]);

/** */
const handleKeyDown = (e) => {
let nextKey = 'ArrowRight';
Expand Down Expand Up @@ -166,6 +175,7 @@ export function ThumbnailNavigation({
tabIndex={0}
onKeyDown={handleKeyDown}
role="grid"
ref={paperRef}
>
<div role="row" style={{ height: '100%', width: '100%' }}>
{ canvasGroupings.length > 0 && (
Expand All @@ -183,6 +193,7 @@ export function ThumbnailNavigation({
layout={(position === 'far-bottom') ? 'horizontal' : 'vertical'}
itemData={itemData}
ref={gridRef}
itemKey={(index) => index}
>
{ThumbnailCanvasGrouping}
</List>
Expand Down