Skip to content

Commit bc7a86b

Browse files
committed
fix(app-shell): a Setup catalog switch the caller cannot use states its state and offers no click (objectui#7611)
Measured as an organization administrator (no manage_metadata) on the permission-set catalog: the switches are disabled, and the read-only reason says why, but each one still announced "Active — click to deactivate". That is the same offer-that-does-nothing shape the switch's label had on a stage-1 framework (finding F3 of round 1). A disabled switch for a caller who cannot author now reads "Active" or "Inactive", the status filter's own strings; an author's switch keeps the click wording, and an audience anchor keeps its reason. Claude-Session: https://claude.ai/code/session_01Rerax7QTjKMPCUZxQUtPFR Co-authored-by: Claude <noreply@anthropic.com>
1 parent 4c62713 commit bc7a86b

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

‎packages/app-shell/src/views/metadata-admin/ResourceListPage.environmentScope-7611.test.tsx‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,10 +219,16 @@ describe('the active switch (the activation ledger, through its door)', () => {
219219
expect(screen.getByTestId('catalog-active-admin_full_access')).toHaveAttribute('aria-checked', 'true');
220220
});
221221

222-
it('is disabled for a caller who cannot author', async () => {
222+
it('is disabled for a caller who cannot author, and states the state without offering a click', async () => {
223223
canAuthor = false;
224224
mount('?scope=environment');
225-
expect(await screen.findByTestId('catalog-active-admin_full_access')).toBeDisabled();
225+
const on = await screen.findByTestId('catalog-active-admin_full_access');
226+
expect(on).toBeDisabled();
227+
expect(on).toHaveAttribute('aria-label', t('engine.catalog.status.active', 'en-US'));
228+
expect(screen.getByTestId('catalog-active-showcase_auditor')).toHaveAttribute(
229+
'aria-label',
230+
t('engine.catalog.status.inactive', 'en-US'),
231+
);
226232
});
227233

228234
it('on positions, an audience anchor is a disabled switch that says why; CONTROL: another position is live', async () => {

‎packages/app-shell/src/views/metadata-admin/ResourceListPage.tsx‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -812,9 +812,13 @@ function CatalogActiveCell({
812812
}
813813
const enabled = isCatalogItemActive(ledger.states, itemName);
814814
const anchor = ledger.anchors.has(itemName);
815+
// A switch the caller cannot use states the state, and offers no click; the
816+
// page's read-only reason says why.
815817
const label = anchor
816818
? t('engine.catalog.active.anchor', locale)
817-
: t(enabled ? 'engine.catalog.active.on' : 'engine.catalog.active.off', locale);
819+
: canSwitch
820+
? t(enabled ? 'engine.catalog.active.on' : 'engine.catalog.active.off', locale)
821+
: t(enabled ? 'engine.catalog.status.active' : 'engine.catalog.status.inactive', locale);
818822
return (
819823
<span className="inline-flex" title={label}>
820824
<Switch

0 commit comments

Comments
 (0)