Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/age-2594-logs-search-clear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"dashboard": patch
---

Logs filter search bars can now be cleared with the Escape key or by emptying the box, not just the × button. This applies to the MCP Server Logs filter bar and the shared SearchBar (Agent Sessions, etc.). Escape only clears when there is text to clear, so an empty box lets the key bubble to close a surrounding popover.
11 changes: 11 additions & 0 deletions client/dashboard/src/components/ui/search-bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,17 @@ export function SearchBar({
placeholder={placeholder}
value={value}
onChange={(e) => onChange(e.target.value)}
onKeyDown={(e) => {
// Escape clears the search, matching the × button. Only when there
// is something to clear: stop propagation so this Escape only clears,
// then an empty box lets the next Escape bubble (e.g. to close a
// surrounding popover).
if (e.key === "Escape" && value) {
e.preventDefault();
Comment thread
cubic-dev-ai[bot] marked this conversation as resolved.
e.stopPropagation();
onChange("");
}
}}
disabled={disabled}
className="min-w-0 flex-1 bg-transparent outline-none disabled:cursor-not-allowed"
/>
Expand Down
22 changes: 20 additions & 2 deletions client/dashboard/src/pages/logs/LogFilterBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,13 @@ export function LogFilterBar({
}
}
onSearchInputChange(value);
// Emptying the box clears the applied search without needing the ×
// button, so results refresh as soon as the query is gone.
if (step === "key" && value === "") {
onSearchSubmit("");
}
},
[step, onSearchInputChange, handleOpSelect],
[step, onSearchInputChange, handleOpSelect, onSearchSubmit],
);

const handleValueSubmit = () => {
Expand Down Expand Up @@ -264,10 +269,23 @@ export function LogFilterBar({
}
break;
case "Escape":
if (popoverOpen) {
if (step === "operator") {
// Cancel an in-progress filter build without touching the applied
// search. Consume the key so it doesn't also close a surrounding
// popover.
e.preventDefault();
Comment thread
cubic-dev-ai[bot] marked this conversation as resolved.
e.stopPropagation();
resetFlow();
} else if (searchInput) {
// Key step: mirror the × button — clear the box and the applied
// search so results refresh without forcing a click. Consume the
// key so this first Escape only clears; once the box is empty the
// next Escape bubbles (e.g. to close a surrounding popover).
e.preventDefault();
e.stopPropagation();
onSearchInputChange("");
resetFlow();
onSearchSubmit("");
}
break;
case "Backspace":
Expand Down
Loading