@@ -225,8 +225,14 @@ export const ChatHistoryListItemCell: React.FC<ChatHistoryListItemCellProps> = (
225225 tabIndex = { 0 }
226226 aria-label = "chat history item"
227227 className = { styles . itemCell }
228- onClick = { ( ) => handleSelectItem ( ) }
229- onKeyDown = { e => ( e . key === 'Enter' || e . key === ' ' ? handleSelectItem ( ) : null ) }
228+ onClick = { ( ) => { if ( ! edit ) handleSelectItem ( ) } }
229+ onKeyDown = { e => {
230+ if ( ! edit && ( e . key === 'Enter' || e . key === ' ' ) ) {
231+ handleSelectItem ( ) ;
232+ } else {
233+ e . stopPropagation ( ) ; // stop from reaching here when editing
234+ }
235+ } }
230236 verticalAlign = "center"
231237 // horizontal
232238 onMouseEnter = { ( ) => setIsHovered ( true ) }
@@ -258,7 +264,7 @@ export const ChatHistoryListItemCell: React.FC<ChatHistoryListItemCellProps> = (
258264 < Stack aria-label = "action button group" horizontal verticalAlign = { 'center' } >
259265 < IconButton
260266 role = "button"
261- disabled = { errorRename !== undefined }
267+ disabled = { errorRename !== undefined || editTitle == item . title }
262268 onKeyDown = { e => ( e . key === ' ' || e . key === 'Enter' ? handleSaveEdit ( e ) : null ) }
263269 onClick = { e => handleSaveEdit ( e ) }
264270 aria-label = "confirm new title"
@@ -311,13 +317,21 @@ export const ChatHistoryListItemCell: React.FC<ChatHistoryListItemCellProps> = (
311317 disabled = { isButtonDisabled }
312318 onKeyDown = { e => ( e . key === ' ' ? toggleDeleteDialog ( ) : null ) }
313319 />
314- < IconButton
320+ < IconButton
315321 className = { styles . itemButton }
316322 iconProps = { { iconName : 'Edit' } }
317323 title = "Edit"
318- onClick = { onEdit }
324+ onClick = { ( e ) => {
325+ e . stopPropagation ( ) ; // Prevent triggering parent click
326+ onEdit ( ) ;
327+ } }
319328 disabled = { isButtonDisabled }
320- onKeyDown = { e => ( e . key === ' ' ? onEdit ( ) : null ) }
329+ onKeyDown = { ( e ) => {
330+ if ( e . key === ' ' ) {
331+ e . stopPropagation ( ) ; // Prevent triggering parent keydown
332+ onEdit ( ) ;
333+ }
334+ } }
321335 />
322336 </ Stack >
323337 ) }
0 commit comments