feat(KB-656): keep list quick entry collapsed on focus
- Add an autoExpand prop to QuickEntryBox with default focus expansion behavior
- Preserve manual expand and blur persistence while allowing list view to opt out
- Add coverage for autoExpand={false} behavior in QuickEntryBox tests
- Include a published-package changeset describing the quick entry behavior change
This commit is contained in:
@@ -325,8 +325,11 @@ export function QuickEntryBox({ onCreate, addToast, tasks = [], availableModels,
|
||||
justResetRef.current = false;
|
||||
return;
|
||||
}
|
||||
// No auto-expand on focus — manual toggle only
|
||||
}, []);
|
||||
// Only auto-expand if autoExpand prop is true (defaults to true for backward compatibility)
|
||||
if (autoExpand) {
|
||||
setIsExpanded(true);
|
||||
}
|
||||
}, [autoExpand]);
|
||||
|
||||
const handleBlur = useCallback(() => {
|
||||
// No auto-collapse on blur — state persists until manually toggled or task is submitted/cancelled
|
||||
|
||||
@@ -210,6 +210,16 @@ describe("QuickEntryBox", () => {
|
||||
expect(textarea.classList.contains("quick-entry-input--expanded")).toBe(true);
|
||||
});
|
||||
|
||||
it("does not expand on focus when autoExpand is false", () => {
|
||||
renderQuickEntryBox({ autoExpand: false });
|
||||
const textarea = screen.getByTestId("quick-entry-input");
|
||||
|
||||
fireEvent.focus(textarea);
|
||||
|
||||
// Should not expand when autoExpand is false
|
||||
expect(textarea.classList.contains("quick-entry-input--expanded")).toBe(false);
|
||||
});
|
||||
|
||||
it("toggle button collapses the view when expanded", () => {
|
||||
renderQuickEntryBox();
|
||||
const textarea = screen.getByTestId("quick-entry-input");
|
||||
|
||||
Reference in New Issue
Block a user