From 28c1a764a77b9ef3b678426860e7edd2bf788c26 Mon Sep 17 00:00:00 2001
From: Dustin Huang {{ selectedComponentKey() }}
Fix the JSON in the Edit JSON tab to enable property editing again.
- {{ fieldError.message }} -
- } @else if (prop.required && prop.value === undefined) { -- Required, but this example doesn't set it. -
- } -- {{ nestedNote }} -
- } @else if (control.kind === 'enum') { - - } @else if (control.kind === 'boolean') { -- {{ nestedFieldError.message }} -
- } -+ {{ !component() ? emptyMessage() : 'No editable properties for this component.' }} +
}+
{{ fieldError.message }}
} @else if (prop.required && prop.value === undefined) { @@ -100,7 +105,7 @@+
{{ nestedFieldError.message }}
} diff --git a/shell/src/app/shared/property-editor/property-editor.spec.ts b/shell/src/app/shared/property-editor/property-editor.spec.ts index b4a295f33..a402bd001 100644 --- a/shell/src/app/shared/property-editor/property-editor.spec.ts +++ b/shell/src/app/shared/property-editor/property-editor.spec.ts @@ -326,6 +326,46 @@ describe('PropertyEditor Component', () => { expect(await harness.getPropertyError('style')).toBeNull(); }); + + it('assigns distinct DOM id prefixes per instance so label[for] and aria-describedby do not collide', async () => { + const secondFixture = TestBed.createComponent(PropertyEditor); + try { + const secondHarness = await TestbedHarnessEnvironment.harnessForFixture( + secondFixture, + PropertyEditorHarness, + ); + const sample = { + id: 'box-1', + component: 'StyledBox', + style: {padding: 8}, + }; + catalogManagementMock.activeCatalog.set(jsonCatalog); + fixture.componentRef.setInput('component', sample); + secondFixture.componentRef.setInput('component', sample); + fixture.detectChanges(); + secondFixture.detectChanges(); + + await harness.editJsonProperty('style', '123'); + + const firstLabelFor = await harness.getPropertyLabelFor('style'); + const secondLabelFor = await secondHarness.getPropertyLabelFor('style'); + const firstControlId = await harness.getPropertyControlId('style'); + const secondControlId = await secondHarness.getPropertyControlId('style'); + const firstErrorId = await harness.getPropertyErrorId('style'); + const firstDescribedBy = await harness.getPropertyAriaDescribedBy('style'); + + expect(firstLabelFor).toMatch(/^property-editor-\d+-style$/); + expect(secondLabelFor).toMatch(/^property-editor-\d+-style$/); + expect(firstLabelFor).not.toBe(secondLabelFor); + expect(firstControlId).toBe(firstLabelFor); + expect(secondControlId).toBe(secondLabelFor); + expect(firstErrorId).toMatch(/^property-editor-\d+-error-style$/); + expect(firstDescribedBy).toBe(firstErrorId); + expect(await secondHarness.getPropertyError('style')).toBeNull(); + } finally { + secondFixture.destroy(); + } + }); }); // Shapes as CatalogSchemaResolver returns them for the basic catalog's common types. diff --git a/shell/src/app/shared/property-editor/property-editor.ts b/shell/src/app/shared/property-editor/property-editor.ts index 26082b79f..5855ed98d 100644 --- a/shell/src/app/shared/property-editor/property-editor.ts +++ b/shell/src/app/shared/property-editor/property-editor.ts @@ -46,6 +46,8 @@ import {stableStringify} from '../../storage/stable-stringify/stable-stringify'; type PropertyPath = ReadonlyArray{{ tree.surfaceId }}
+ · {{ tree.componentCount }} components
+ @if (tree.truncated) {
+ truncated
+ }
+ rootroot{{ status }}
+ } +