@@ -210,6 +210,15 @@ export const FilesCardBody = ({
210210 }
211211 } ;
212212
213+ const handleAuxClick = ( ev : MouseEvent ) => {
214+ const name = getFilenameForEvent ( ev ) ;
215+ const file = sortedFiles ?. find ( file => file . name === name ) ;
216+
217+ if ( ev . button === 1 && file ?. to !== "dir" ) {
218+ ev . preventDefault ( ) ;
219+ }
220+ } ;
221+
213222 const handleContextMenu = ( event : MouseEvent ) => {
214223 const name = getFilenameForEvent ( event ) ;
215224 if ( name !== null && selected . length > 1 ) {
@@ -273,6 +282,7 @@ export const FilesCardBody = ({
273282 folderViewElem . addEventListener ( "click" , handleClick ) ;
274283 folderViewElem . addEventListener ( "dblclick" , handleDoubleClick ) ;
275284 folderViewElem . addEventListener ( "contextmenu" , handleContextMenu ) ;
285+ folderViewElem . addEventListener ( "auxclick" , handleAuxClick ) ;
276286 }
277287
278288 if ( ! isMounted . current && ! dialogs . isActive ( ) ) {
@@ -288,6 +298,7 @@ export const FilesCardBody = ({
288298 folderViewElem . removeEventListener ( "click" , handleClick ) ;
289299 folderViewElem . removeEventListener ( "dblclick" , handleDoubleClick ) ;
290300 folderViewElem . removeEventListener ( "contextmenu" , handleContextMenu ) ;
301+ folderViewElem . removeEventListener ( "auxclick" , handleAuxClick ) ;
291302 }
292303 } ;
293304 } , [
@@ -389,6 +400,7 @@ export const FilesCardBody = ({
389400 < Row
390401 key = { rowIndex }
391402 file = { file }
403+ path = { path }
392404 isSelected = { selected . some ( s => s . name === file . name ) }
393405 /> ) }
394406 </ Tbody >
@@ -408,8 +420,9 @@ const getFileType = (file: FolderFileInfo) => {
408420} ;
409421
410422// Memoize the Item component as rendering thousands of them on each render of parent component is costly.
411- const Row = React . memo ( function Item ( { file, isSelected } : {
423+ const Row = React . memo ( function Item ( { file, path , isSelected } : {
412424 file : FolderFileInfo ,
425+ path : string [ ] ,
413426 isSelected : boolean
414427} ) {
415428 const fileType = getFileType ( file ) ;
@@ -418,6 +431,8 @@ const Row = React.memo(function Item({ file, isSelected } : {
418431 className += " row-selected" ;
419432 if ( file . type === "lnk" )
420433 className += " symlink" ;
434+ const filePath = ( file . type === "dir" &&
435+ `${ cockpit . transport . origin } /files#/?path=${ encodeURIComponent ( [ ...path , file . name ] . join ( "/" ) ) } ` ) || "#" ;
421436
422437 return (
423438 < Tr
@@ -428,7 +443,7 @@ const Row = React.memo(function Item({ file, isSelected } : {
428443 className = "item-name"
429444 dataLabel = { fileType }
430445 >
431- < a href = "#" > { file . name } </ a >
446+ < a href = { filePath } > { file . name } </ a >
432447 </ Td >
433448 < Td
434449 className = "item-size pf-v5-m-tabular-nums"
0 commit comments