Description
Problem
Without user intent you cannot switch to a different tab
https://aws.github.io/mynah-ui/api-doc/classes/MynahUI.html#selectTab
Using mynah-ui in vs code extension there is not currently available a good way to have a notification callback command select a tab if many are open and the responding message is not in the currently focused tab
User Story: If i have many tabs in the mynah chat in vs code open, and one that receives a response that generates a vs code notification, i would like to be able to click the notification and refocus on said tab
Expected behavior
Add setFocusTab
as a public member of mynah class that can deterministically set focus on the specific tab without having an eventId (it can generate one) retaining eventId as private generated id
Existing closed PR
Solution is here #116
Closed with unmerged commits
This pull request is closed, but the AWS-Q:32teeth/feature/setFocusTab branch has unmerged commits.
/**
* Selects a tab with the given generated ID.
* @param tabId - The ID of the tab to select.
* @returns void
* This function is used to select a tab with the given generated ID.
* If the tab does not exist, it will not select any tab.
* This function is useful when you want to select a tab with a known ID, yet without user interaction.
* for example, in response to a message from the chat, which produces a notification and the tab currently selected is not the one that the notification is related to.
* @example
*/
public setFocusTab = (tabId: string): void => {
if (MynahUITabsStore.getInstance().getTab(tabId) !== null) {
const eventId = this.getUserEventId();
this.selectTab(tabId, eventId);
}
};