Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

public method for tab focus from agent #137

Closed
32teeth opened this issue Oct 15, 2024 · 1 comment
Closed

public method for tab focus from agent #137

32teeth opened this issue Oct 15, 2024 · 1 comment

Comments

@32teeth
Copy link
Contributor

32teeth commented Oct 15, 2024

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);
    }
  };
@dogusata
Copy link
Collaborator

The eventId check is removed from the selectTab method. Please use selectTab method from the main class instance.

#141

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants