@@ -32,6 +32,7 @@ class ChatMenu extends React.Component {
3232 editChat : false ,
3333 editChatName : "" ,
3434 hoveredKey : null ,
35+ popconfirmOpenKey : null ,
3536 } ;
3637 }
3738
@@ -58,6 +59,8 @@ class ChatMenu extends React.Component {
5859 const itemKey = `${ index } -${ chatIndex } ` ;
5960 const isSelected = selectedKeys . includes ( itemKey ) ;
6061 const isHovered = this . state !== undefined && this . state . hoveredKey === itemKey ;
62+ const popconfirmOpenKey = this . state !== undefined ? this . state . popconfirmOpenKey : null ;
63+ const showActionButtons = popconfirmOpenKey === itemKey || ( isHovered && popconfirmOpenKey === null ) ;
6164 const handleIconMouseEnter = ( e ) => {
6265 e . currentTarget . style . color = ThemeDefault . colorPrimary ;
6366 e . currentTarget . style . opacity = 0.6 ;
@@ -119,7 +122,7 @@ class ChatMenu extends React.Component {
119122 < div style = { { flex : 1 , minWidth : 0 , overflow : "hidden" , textOverflow : "ellipsis" , whiteSpace : "nowrap" } } >
120123 < Tooltip title = { chat . displayName } > { chat . displayName } </ Tooltip >
121124 </ div >
122- { isHovered && (
125+ { showActionButtons && (
123126 < div >
124127 < EditOutlined className = "menu-item-icon"
125128 onMouseEnter = { handleIconMouseEnter }
@@ -135,6 +138,9 @@ class ChatMenu extends React.Component {
135138 } } />
136139 < Popconfirm
137140 title = { `${ i18next . t ( "general:Sure to delete" ) } : ${ chat . displayName } ?` }
141+ onOpenChange = { ( open ) => {
142+ this . setState ( { popconfirmOpenKey : open ? itemKey : null } ) ;
143+ } }
138144 onConfirm = { ( ) => {
139145 if ( this . props . onDeleteChat ) {
140146 this . props . onDeleteChat ( globalChatIndex ) ;
0 commit comments