Skip to content

Commit 11900ca

Browse files
authored
fix(amazonq): mcp tool panel blocks amazon q chat interface when using right-click context menu (#2442)
1 parent 550e0ea commit 11900ca

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

chat-client/src/client/mcpMynahUi.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,17 @@ export class McpMynahUi {
8181
private mynahUi: MynahUI
8282
private messager: Messager
8383
private isMcpServersListActive = false
84+
private mcpDetailedList: { close: () => void } | undefined
8485

8586
constructor(mynahUi: MynahUI, messager: Messager) {
8687
this.mynahUi = mynahUi
8788
this.messager = messager
8889
}
8990

91+
close() {
92+
this.mcpDetailedList?.close()
93+
}
94+
9095
/**
9196
* Processes filter options by converting icons to Mynah icons
9297
*/
@@ -397,15 +402,15 @@ export class McpMynahUi {
397402
;(detailedList.filterOptions[0] as any).autoFocus = true
398403
}
399404

400-
const mcpSheet = this.mynahUi.openDetailedList({
405+
this.mcpDetailedList = this.mynahUi.openDetailedList({
401406
detailedList: detailedList,
402407
events: {
403408
onFilterValueChange: (filterValues: Record<string, any>) => {
404409
this.messager.onListMcpServers(filterValues)
405410
},
406411
onKeyPress: (e: KeyboardEvent) => {
407412
if (e.key === 'Escape') {
408-
mcpSheet.close()
413+
this.mcpDetailedList?.close()
409414
}
410415
},
411416
onItemSelect: (item: DetailedListItem) => {
@@ -426,6 +431,7 @@ export class McpMynahUi {
426431
},
427432
onClose: () => {
428433
this.isMcpServersListActive = false
434+
this.mcpDetailedList = undefined
429435
},
430436
onTitleActionClick: button => {
431437
this.messager.onMcpServerClick(button.id)

chat-client/src/client/mynahUi.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1417,7 +1417,8 @@ export const createMynahUi = (
14171417
const sendToPrompt = (params: SendToPromptParams) => {
14181418
const tabId = getOrCreateTabId()
14191419
if (!tabId) return
1420-
1420+
chatHistoryList.close()
1421+
mcpMynahUi.close()
14211422
if (params.autoSubmit && params.prompt) {
14221423
messager.onChatPrompt({ prompt: params.prompt, tabId, context: undefined }, 'contextMenu')
14231424
initializeChatResponse(mynahUi, tabId, params.prompt.prompt, agenticMode)
@@ -1431,7 +1432,8 @@ export const createMynahUi = (
14311432
let tabId = getOrCreateTabId()
14321433

14331434
if (!tabId) return
1434-
1435+
chatHistoryList.close()
1436+
mcpMynahUi.close()
14351437
// send to a new tab if the current tab is loading
14361438
if (getTabStore(tabId)?.loadingChat) {
14371439
tabId = createTabId()

0 commit comments

Comments
 (0)