Skip to content

Commit 994f836

Browse files
committed
fix(web): keep provider update popover usable in read-only editor
The editor header wrapped the shared update control in inert, so the popover and copy command could not open. Only Update now is suppressed in read-only mode.
1 parent f738470 commit 994f836

2 files changed

Lines changed: 31 additions & 21 deletions

File tree

‎apps/web/src/components/settings/ProviderInstanceCard.test.ts‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,4 +210,12 @@ describe("ProviderInstanceCard update affordance", () => {
210210
expect(markup).not.toContain("Copy codex update command");
211211
}
212212
});
213+
214+
it("keeps the editor update glyph outside the read-only inert wrapper", () => {
215+
const markup = renderToStaticMarkup(
216+
createElement(ProviderInstanceCard, { ...props, mode: "editor", readOnly: true }),
217+
);
218+
expect(markup).toContain('aria-label="Update available — view details"');
219+
expect(markup).not.toMatch(/inert[\s\S]*aria-label="Update available — view details"/);
220+
});
213221
});

‎apps/web/src/components/settings/ProviderInstanceCard.tsx‎

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -798,27 +798,29 @@ export function ProviderInstanceCard({
798798
</Badge>
799799
) : null}
800800
{versionCodeNode}
801-
<span
802-
inert={readOnly}
803-
aria-disabled={readOnly || undefined}
804-
className={cn("inline-flex items-center gap-1", readOnly && "opacity-50")}
805-
>
806-
{updateAvailableControl}
807-
{titleTailNode}
808-
{onDelete ? (
809-
<Button
810-
type="button"
811-
size="icon-xs"
812-
variant="ghost-muted"
813-
disabled={readOnly}
814-
className="[--control-icon-color:currentColor] hover:text-destructive"
815-
onClick={onDelete}
816-
aria-label={`Delete instance ${instanceId}`}
817-
>
818-
<Trash2Icon />
819-
</Button>
820-
) : null}
821-
</span>
801+
{updateAvailableControl}
802+
{titleTailNode || onDelete ? (
803+
<span
804+
inert={readOnly}
805+
aria-disabled={readOnly || undefined}
806+
className={cn("inline-flex items-center gap-1", readOnly && "opacity-50")}
807+
>
808+
{titleTailNode}
809+
{onDelete ? (
810+
<Button
811+
type="button"
812+
size="icon-xs"
813+
variant="ghost-muted"
814+
disabled={readOnly}
815+
className="[--control-icon-color:currentColor] hover:text-destructive"
816+
onClick={onDelete}
817+
aria-label={`Delete instance ${instanceId}`}
818+
>
819+
<Trash2Icon />
820+
</Button>
821+
) : null}
822+
</span>
823+
) : null}
822824
</div>
823825
);
824826

0 commit comments

Comments
 (0)