Merge pull request #4248 from continuedev/dallin/focus-issues
Fix Focus Issues with Tools Dropdown and Query Context Providers
This commit is contained in:
commit
0a22ae3854
4 changed files with 12 additions and 6 deletions
|
|
@ -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">
|
||||
|
|
|
|||
|
|
@ -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}
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
>
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue