@@ -225,8 +225,14 @@ export const ChatHistoryListItemCell: React.FC<ChatHistoryListItemCellProps> = (
225
225
tabIndex = { 0 }
226
226
aria-label = "chat history item"
227
227
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
+ } }
230
236
verticalAlign = "center"
231
237
// horizontal
232
238
onMouseEnter = { ( ) => setIsHovered ( true ) }
@@ -258,7 +264,7 @@ export const ChatHistoryListItemCell: React.FC<ChatHistoryListItemCellProps> = (
258
264
< Stack aria-label = "action button group" horizontal verticalAlign = { 'center' } >
259
265
< IconButton
260
266
role = "button"
261
- disabled = { errorRename !== undefined }
267
+ disabled = { errorRename !== undefined || editTitle == item . title }
262
268
onKeyDown = { e => ( e . key === ' ' || e . key === 'Enter' ? handleSaveEdit ( e ) : null ) }
263
269
onClick = { e => handleSaveEdit ( e ) }
264
270
aria-label = "confirm new title"
@@ -311,13 +317,21 @@ export const ChatHistoryListItemCell: React.FC<ChatHistoryListItemCellProps> = (
311
317
disabled = { isButtonDisabled }
312
318
onKeyDown = { e => ( e . key === ' ' ? toggleDeleteDialog ( ) : null ) }
313
319
/>
314
- < IconButton
320
+ < IconButton
315
321
className = { styles . itemButton }
316
322
iconProps = { { iconName : 'Edit' } }
317
323
title = "Edit"
318
- onClick = { onEdit }
324
+ onClick = { ( e ) => {
325
+ e . stopPropagation ( ) ; // Prevent triggering parent click
326
+ onEdit ( ) ;
327
+ } }
319
328
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
+ } }
321
335
/>
322
336
</ Stack >
323
337
) }
0 commit comments