fix(ui): remove redundant file-preview Escape hint (#100528)

Co-authored-by: 咸士山 0668001391 <xian.shishan@xydigit.com>
This commit is contained in:
Peter Steinberger
2026-07-06 02:25:17 +01:00
committed by GitHub
parent 08852d2bf7
commit 797bca251e
2 changed files with 12 additions and 9 deletions

View File

@@ -67,6 +67,17 @@ describe("openclaw-file-preview-modal", () => {
expect(shadowText(modal)).toContain("noreply@example.com");
});
it("shows the Escape shortcut only on the close button", async () => {
const modal = await renderPreview();
const state = modal.shadowRoot?.querySelector<HTMLElement>(".state");
const closeButton = modal.shadowRoot?.querySelector<HTMLButtonElement>(".button");
expect(state?.textContent?.trim()).toBe("2 files");
expect(state?.querySelector(".kbd")).toBeNull();
expect(closeButton?.textContent?.replace(/\s+/g, " ").trim()).toBe("Close esc");
expect(closeButton?.querySelector(".kbd")?.textContent).toBe("esc");
});
it("emits controlled query, select, and close events", async () => {
const modal = await renderPreview();
const onQuery = vi.fn();

View File

@@ -124,20 +124,12 @@ export class OpenClawFilePreviewModal extends LitElement {
background: var(--bg-elevated);
}
.esc,
.kbd {
font-family: var(--mono);
border: 1px solid var(--border);
color: var(--muted);
}
.esc {
font-size: 10px;
padding: 1px 5px;
border-radius: 3px;
background: var(--bg);
}
.body {
flex: 1;
display: grid;
@@ -404,7 +396,7 @@ export class OpenClawFilePreviewModal extends LitElement {
@input=${this.handleQueryInput}
autofocus
/>
<span class="state">${fileCount} <span class="esc">esc</span></span>
<span class="state">${fileCount}</span>
</header>
<div class="body">
<aside class="list">