aws / mynah-ui

https://aws.github.io/mynah-ui/
Apache License 2.0
13 stars 11 forks source link

fix: restore command prompt when blurred then focused #74

Closed 32teeth closed 1 month ago

32teeth commented 2 months ago

Problem

When a user types a quick action command starting with / or a context command starting with @ and then loses focus, the command context is lost. When the user refocuses on the input field and continues typing, the quick pick overlay does not reappear, causing the command to never be picked up.

Solution

Preview

restoreCommandsOnFocus

To Do

[!TIP] Tomorrow Day Problems

  • chat-prompt-input.ts could probably use some redundancy grouping for similar functionality
  • handleInputKeydown has a complexity score of 54

License

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

dogusata commented 2 months ago

There are two issues related with the @ command picker in the PR:

1st issue

When user starts with @ to pick a context (currently this is the general expected behavior btw.) and blurs the input area and comes back in. There is an additional @ char.

Gif: (loading) context-selector-problem-1

2nd issue

When there is another context picker trigger (second @) it becomes not possible to write text again.

Gif: (loading) context-selector-problem-2

Note about how they are and should work: Quick action commands can be opened only if there is no text written. Even after you type sth. you cannot go back to the beginning of the line and open it. Reason behind that is we cannot be sure that if the command accepts additional text or not. And there can be only one command selected.

However, context selection (@) is different, it is just a predefined text selection which always starts with @. User can select them anywhere inside the text and pick as much as they want.

32teeth commented 2 months ago

However, context selection (@) is different, it is just a predefined text selection which always starts with @. User can select them anywhere inside the text and pick as much as they want.

Ah, GTK! TY

dogusata commented 2 months ago

However, context selection (@) is different, it is just a predefined text selection which always starts with @. User can select them anywhere inside the text and pick as much as they want.

Ah, GTK! TY

Checked, works as expected 👍🏻

32teeth commented 2 months ago

@dogusata Any hesitation on merge?