Merge pull request #4248 from continuedev/dallin/focus-issues

Fix Focus Issues with Tools Dropdown and Query Context Providers
This commit is contained in:
Nate Sesti 2025-02-21 09:58:23 -08:00 • committed by GitHub
commit 0a22ae3854
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 12 additions and 6 deletions

View file

@ -106,7 +106,6 @@ function InputToolbar(props: InputToolbarProps) {
<StyledDiv
isHidden={props.hidden}
onClick={props.onClick}
id="input-toolbar"
className="find-widget-skip flex"
>
<div className="flex items-center justify-start gap-2 whitespace-nowrap">

View file

@ -153,7 +153,7 @@ export default function ToolDropdown(props: ToolDropdownProps) {
/>
</div>
</div>
<div className="max-h-48 overflow-y-auto overflow-x-hidden">
<div className="max-h-48 overflow-y-auto overflow-x-hidden pr-2">
{availableTools.map((tool: any) => (
<Listbox.Option
key={tool.function.name}

View file

@ -257,7 +257,7 @@ const MentionList = forwardRef((props: MentionListProps, ref) => {
if (queryInputRef.current) {
queryInputRef.current.focus();
}
}, [querySubmenuItem]);
}, [querySubmenuItem, queryInputRef]);
const selectItem = (index: number) => {
const item = allItems[index];
@ -378,6 +378,9 @@ const MentionList = forwardRef((props: MentionListProps, ref) => {
<ItemsDiv>
{querySubmenuItem ? (
<QueryInput
onClick={(e) => {
e.stopPropagation();
}}
rows={1}
ref={queryInputRef}
placeholder={querySubmenuItem.description}
@ -436,7 +439,10 @@ const MentionList = forwardRef((props: MentionListProps, ref) => {
ref={(el) => (itemRefs.current[index] = el)}
className={`item cursor-pointer ${isSelected ? "is-selected" : ""}`}
key={index}
onClick={() => selectItem(index)}
onClick={(e) => {
e.stopPropagation();
selectItem(index);
}}
onMouseEnter={() => setSelectedIndex(index)}
data-testid="context-provider-dropdown-item"
>

View file

@ -591,11 +591,12 @@ function TipTapEditor(props: TipTapEditorProps) {
useEffect(() => {
if (editor) {
const handleFocus = () => {
debouncedShouldHideToolbar(false);
setShouldHideToolbar(false);
};
const handleBlur = () => {
debouncedShouldHideToolbar(true);
// TODO - make toolbar auto-hiding work without breaking tool dropdown focus
// debouncedShouldHideToolbar(true);
};
editor.on("focus", handleFocus);