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}
|
||||
onChange={(e) => setNewDirName(e.target.value)}
|
||||
onKeyDown={(e) => {
|
||||
e.stopPropagation();
|
||||
if (e.key === 'Enter') {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
createDirectory();
|
||||
} else if (e.key === 'Escape') {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
cancelCreatingDirectory();
|
||||
}
|
||||
}}
|
||||
@@ -904,13 +903,12 @@ export const DirectoryTree: React.FC<DirectoryTreeProps> = ({
|
||||
value={newDirName}
|
||||
onChange={(e) => setNewDirName(e.target.value)}
|
||||
onKeyDown={(e) => {
|
||||
e.stopPropagation();
|
||||
if (e.key === 'Enter') {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
createDirectory();
|
||||
} else if (e.key === 'Escape') {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
cancelCreatingDirectory();
|
||||
}
|
||||
}}
|
||||
|
||||
@@ -299,6 +299,10 @@ export function NewWorktreeDialog({
|
||||
const existingBranchMobileListWrapperRef = 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 => {
|
||||
let node: HTMLElement | null = startNode;
|
||||
while (node && node !== document.body) {
|
||||
@@ -1600,6 +1604,7 @@ export function NewWorktreeDialog({
|
||||
placeholder={t('session.newWorktree.searchBranches')}
|
||||
value={existingBranchQuery}
|
||||
onValueChange={setExistingBranchQuery}
|
||||
onKeyDown={stopDropdownTypeahead}
|
||||
/>
|
||||
<CommandList disableHorizontal>
|
||||
{isLoadingBranches ? (
|
||||
@@ -1840,6 +1845,7 @@ export function NewWorktreeDialog({
|
||||
placeholder={t('session.newWorktree.searchBranches')}
|
||||
value={sourceBranchQuery}
|
||||
onValueChange={setSourceBranchQuery}
|
||||
onKeyDown={stopDropdownTypeahead}
|
||||
/>
|
||||
<CommandList disableHorizontal>
|
||||
{isLoadingBranches ? (
|
||||
|
||||
@@ -189,6 +189,7 @@ export const BranchSelector: React.FC<BranchSelectorProps> = ({
|
||||
placeholder={t('gitView.branch.searchPlaceholder')}
|
||||
value={search}
|
||||
onValueChange={setSearch}
|
||||
onKeyDown={stopDropdownTypeahead}
|
||||
/>
|
||||
<CommandList
|
||||
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"
|
||||
>
|
||||
<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
|
||||
className="h-full min-h-0"
|
||||
scrollbarClassName="overlay-scrollbar--flush overlay-scrollbar--dense overlay-scrollbar--zero"
|
||||
|
||||
Reference in New Issue
Block a user