Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ export class UmbCompositionPickerModalElement extends UmbModalBaseElement<
@state()
private _usedForComposition: Array<string> = [];

/**
* Loading state for the composition data fetch.
* Initialized to true to show loader immediately when modal opens.
* Set to false when data is successfully loaded or an error occurs.
*/
@state()
private _loading = true;

override connectedCallback() {
super.connectedCallback();

Expand Down Expand Up @@ -113,14 +121,19 @@ export class UmbCompositionPickerModalElement extends UmbModalBaseElement<
currentPropertyAliases: currentPropertyAliases,
});

if (!data) return;
if (!data) {
this._loading = false;
return;
}

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
const grouped = Object.groupBy(data, (item) => '/' + item.folderPath.join('/'));
this._compatibleCompositions = Object.keys(grouped)
.sort((a, b) => a.localeCompare(b))
.map((key) => ({ path: key, compositions: grouped[key] }));

this._loading = false;
}

#onSelectionAdd(unique: string) {
Expand Down Expand Up @@ -183,6 +196,12 @@ export class UmbCompositionPickerModalElement extends UmbModalBaseElement<
}

#renderAvailableCompositions() {
if (this._loading) {
return html`<div id="loader" role="status" aria-live="polite" aria-label="Loading compositions">
<uui-loader></uui-loader>
</div>`;
Comment on lines +200 to +202
Copy link

Copilot AI Dec 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The loader div includes accessibility attributes role="status", aria-live="polite", and aria-label="Loading compositions". While these attributes improve accessibility, they differ from the reference implementation in block-catalogue-modal.element.ts (line 208), which doesn't include any accessibility attributes.

For consistency and better accessibility across the application, consider:

  1. If these accessibility attributes are an improvement (which they are), update the block-catalogue-modal to include them as well
  2. Document this as a recommended pattern for loading indicators in modals

The current attributes are appropriate and follow WCAG guidelines for live regions.

Copilot uses AI. Check for mistakes.
}

if (this._compatibleCompositions) {
return html`
<umb-localize key="contentTypeEditor_compositionsDescription">
Expand Down Expand Up @@ -242,6 +261,14 @@ export class UmbCompositionPickerModalElement extends UmbModalBaseElement<

static override styles = [
css`
#loader {
display: flex;
justify-content: center;
align-items: center;
padding: var(--uui-size-layout-1);
min-height: 200px;
Comment on lines +267 to +269
Copy link

Copilot AI Dec 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The loader styling differs slightly from the reference pattern in block-catalogue-modal.element.ts (line 288-291). The reference implementation only uses display: flex and justify-content: center, while this implementation adds align-items: center, padding, and min-height.

While the additional styling properties are reasonable and may provide a better user experience with vertical centering and minimum space, consider whether this intentional enhancement should be documented or if consistency with the existing pattern is preferred. If this is an improvement, consider updating the block-catalogue-modal to match this pattern for consistency across the application.

Suggested change
align-items: center;
padding: var(--uui-size-layout-1);
min-height: 200px;

Copilot uses AI. Check for mistakes.
}

uui-input {
margin: var(--uui-size-6) 0;
display: flex;
Expand Down
Loading
Loading