File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -64,7 +64,6 @@ export class ThumbnailCanvasGrouping extends PureComponent {
6464 role = "button"
6565 data-canvas-id = { currentGroupings [ 0 ] . id }
6666 data-canvas-index = { currentGroupings [ 0 ] . index }
67- onKeyUp = { this . setCanvas }
6867 onClick = { this . setCanvas }
6968 tabIndex = { - 1 }
7069 sx = { theme => ( {
Original file line number Diff line number Diff line change @@ -34,6 +34,15 @@ export function ThumbnailNavigation({
3434 gridRef . current ?. scrollToItem ( index , 'center' ) ;
3535 } , [ canvasIndex , view ] ) ;
3636
37+ // Prevent loss of focus when navigating thumbnails
38+ const paperRef = useRef ( null ) ;
39+
40+ useEffect ( ( ) => {
41+ if ( paperRef . current && document . activeElement !== paperRef . current ) {
42+ paperRef . current . focus ( ) ;
43+ }
44+ } , [ canvasIndex ] ) ;
45+
3746 /** */
3847 const handleKeyDown = ( e ) => {
3948 let nextKey = 'ArrowRight' ;
@@ -166,6 +175,7 @@ export function ThumbnailNavigation({
166175 tabIndex = { 0 }
167176 onKeyDown = { handleKeyDown }
168177 role = "grid"
178+ ref = { paperRef }
169179 >
170180 < div role = "row" style = { { height : '100%' , width : '100%' } } >
171181 { canvasGroupings . length > 0 && (
@@ -183,6 +193,7 @@ export function ThumbnailNavigation({
183193 layout = { ( position === 'far-bottom' ) ? 'horizontal' : 'vertical' }
184194 itemData = { itemData }
185195 ref = { gridRef }
196+ itemKey = { ( index ) => index }
186197 >
187198 { ThumbnailCanvasGrouping }
188199 </ List >
You can’t perform that action at this time.
0 commit comments