fix: restore typing in branch dropdown search fields
Prevent menu typeahead from intercepting search input keystrokes Fix branch search in worktree and Git sidebar dropdowns Cover related directory tree and integrate branch inputs
This commit is contained in:
@@ -815,13 +815,12 @@ export const DirectoryTree: React.FC<DirectoryTreeProps> = ({
|
|||||||
value={newDirName}
|
value={newDirName}
|
||||||
onChange={(e) => setNewDirName(e.target.value)}
|
onChange={(e) => setNewDirName(e.target.value)}
|
||||||
onKeyDown={(e) => {
|
onKeyDown={(e) => {
|
||||||
|
e.stopPropagation();
|
||||||
if (e.key === 'Enter') {
|
if (e.key === 'Enter') {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
|
||||||
createDirectory();
|
createDirectory();
|
||||||
} else if (e.key === 'Escape') {
|
} else if (e.key === 'Escape') {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
|
||||||
cancelCreatingDirectory();
|
cancelCreatingDirectory();
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
@@ -904,13 +903,12 @@ export const DirectoryTree: React.FC<DirectoryTreeProps> = ({
|
|||||||
value={newDirName}
|
value={newDirName}
|
||||||
onChange={(e) => setNewDirName(e.target.value)}
|
onChange={(e) => setNewDirName(e.target.value)}
|
||||||
onKeyDown={(e) => {
|
onKeyDown={(e) => {
|
||||||
|
e.stopPropagation();
|
||||||
if (e.key === 'Enter') {
|
if (e.key === 'Enter') {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
|
||||||
createDirectory();
|
createDirectory();
|
||||||
} else if (e.key === 'Escape') {
|
} else if (e.key === 'Escape') {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
|
||||||
cancelCreatingDirectory();
|
cancelCreatingDirectory();
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -299,6 +299,10 @@ export function NewWorktreeDialog({
|
|||||||
const existingBranchMobileListWrapperRef = React.useRef<HTMLDivElement | null>(null);
|
const existingBranchMobileListWrapperRef = React.useRef<HTMLDivElement | null>(null);
|
||||||
const sourceBranchMobileListWrapperRef = React.useRef<HTMLDivElement | null>(null);
|
const sourceBranchMobileListWrapperRef = React.useRef<HTMLDivElement | null>(null);
|
||||||
|
|
||||||
|
const stopDropdownTypeahead = React.useCallback((event: React.KeyboardEvent<HTMLInputElement>) => {
|
||||||
|
event.stopPropagation();
|
||||||
|
}, []);
|
||||||
|
|
||||||
const findScrollableContainer = React.useCallback((startNode: HTMLElement | null): HTMLElement | null => {
|
const findScrollableContainer = React.useCallback((startNode: HTMLElement | null): HTMLElement | null => {
|
||||||
let node: HTMLElement | null = startNode;
|
let node: HTMLElement | null = startNode;
|
||||||
while (node && node !== document.body) {
|
while (node && node !== document.body) {
|
||||||
@@ -1600,6 +1604,7 @@ export function NewWorktreeDialog({
|
|||||||
placeholder={t('session.newWorktree.searchBranches')}
|
placeholder={t('session.newWorktree.searchBranches')}
|
||||||
value={existingBranchQuery}
|
value={existingBranchQuery}
|
||||||
onValueChange={setExistingBranchQuery}
|
onValueChange={setExistingBranchQuery}
|
||||||
|
onKeyDown={stopDropdownTypeahead}
|
||||||
/>
|
/>
|
||||||
<CommandList disableHorizontal>
|
<CommandList disableHorizontal>
|
||||||
{isLoadingBranches ? (
|
{isLoadingBranches ? (
|
||||||
@@ -1840,6 +1845,7 @@ export function NewWorktreeDialog({
|
|||||||
placeholder={t('session.newWorktree.searchBranches')}
|
placeholder={t('session.newWorktree.searchBranches')}
|
||||||
value={sourceBranchQuery}
|
value={sourceBranchQuery}
|
||||||
onValueChange={setSourceBranchQuery}
|
onValueChange={setSourceBranchQuery}
|
||||||
|
onKeyDown={stopDropdownTypeahead}
|
||||||
/>
|
/>
|
||||||
<CommandList disableHorizontal>
|
<CommandList disableHorizontal>
|
||||||
{isLoadingBranches ? (
|
{isLoadingBranches ? (
|
||||||
|
|||||||
@@ -189,6 +189,7 @@ export const BranchSelector: React.FC<BranchSelectorProps> = ({
|
|||||||
placeholder={t('gitView.branch.searchPlaceholder')}
|
placeholder={t('gitView.branch.searchPlaceholder')}
|
||||||
value={search}
|
value={search}
|
||||||
onValueChange={setSearch}
|
onValueChange={setSearch}
|
||||||
|
onKeyDown={stopDropdownTypeahead}
|
||||||
/>
|
/>
|
||||||
<CommandList
|
<CommandList
|
||||||
scrollbarClassName="overlay-scrollbar--flush overlay-scrollbar--dense overlay-scrollbar--zero"
|
scrollbarClassName="overlay-scrollbar--flush overlay-scrollbar--dense overlay-scrollbar--zero"
|
||||||
|
|||||||
@@ -383,7 +383,11 @@ export const IntegrateCommitsSection: React.FC<{
|
|||||||
className="w-72 p-0 max-h-[var(--available-height)] flex flex-col overflow-hidden"
|
className="w-72 p-0 max-h-[var(--available-height)] flex flex-col overflow-hidden"
|
||||||
>
|
>
|
||||||
<Command className="h-full min-h-0">
|
<Command className="h-full min-h-0">
|
||||||
<CommandInput ref={searchInputRef} placeholder={t('gitView.branch.searchPlaceholder')} />
|
<CommandInput
|
||||||
|
ref={searchInputRef}
|
||||||
|
placeholder={t('gitView.branch.searchPlaceholder')}
|
||||||
|
onKeyDown={(event) => event.stopPropagation()}
|
||||||
|
/>
|
||||||
<CommandList
|
<CommandList
|
||||||
className="h-full min-h-0"
|
className="h-full min-h-0"
|
||||||
scrollbarClassName="overlay-scrollbar--flush overlay-scrollbar--dense overlay-scrollbar--zero"
|
scrollbarClassName="overlay-scrollbar--flush overlay-scrollbar--dense overlay-scrollbar--zero"
|
||||||
|
|||||||
Reference in New Issue
Block a user