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 @@ -59,6 +59,30 @@
};
}



override focus() {
const extensionComponent = this.renderRoot.querySelector('umb-extension-with-api-slot');
if (!extensionComponent) return;

// Wait for the slot component to render
extensionComponent.updateComplete.then(() => {
const firstEntityAction = extensionComponent.shadowRoot?.querySelector('umb-entity-action');
if (!firstEntityAction) return;

firstEntityAction.updateComplete.then(() => {
const firstMenuItem = firstEntityAction.shadowRoot?.querySelector('uui-menu-item');

firstMenuItem?.updateComplete?.then(() => {
const labelButton = firstMenuItem.shadowRoot?.querySelector('#label-button') as HTMLElement;
labelButton?.focus();
});
});
});
}

Check warning on line 82 in src/Umbraco.Web.UI.Client/src/packages/core/entity-action/entity-action-list.element.ts

View check run for this annotation

CodeScene Delta Analysis / CodeScene Code Health Review (main)

❌ New issue: Complex Method

UmbEntityActionListElement.focus has a cyclomatic complexity of 9, threshold = 9. This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring.



#hasRenderedOnce?: boolean;
override render() {
return this._filter
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { UmbDropdownElement } from '../../../components/dropdown/index.js';
import { UmbEntityActionListElement } from '../../entity-action-list.element.js';
import { html, customElement, property, css, query } from '@umbraco-cms/backoffice/external/lit';
import { html, customElement, property, css, query, nothing } from '@umbraco-cms/backoffice/external/lit';

Check failure on line 3 in src/Umbraco.Web.UI.Client/src/packages/core/entity-action/global-components/entity-actions-dropdown/entity-actions-dropdown.element.ts

View workflow job for this annotation

GitHub Actions / build

'nothing' is defined but never used
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
import { UUIScrollContainerElement } from '@umbraco-cms/backoffice/external/uui';
import { UMB_ENTITY_CONTEXT, type UmbEntityModel } from '@umbraco-cms/backoffice/entity';
Expand Down Expand Up @@ -48,8 +48,9 @@
}

#onDropdownOpened() {
if (this.#scrollContainerElement) {
return; // Already created
if (this.#entityActionListElement) {
this.#entityActionListElement.focus();
return;
}

// First create dropdown content when the dropdown is opened.
Expand All @@ -64,11 +65,16 @@
this._dropdownElement?.appendChild(this.#scrollContainerElement);
}


override render() {
return html`<umb-dropdown
id="action-modal"
@click=${this.#onDropdownClick}
@opened=${this.#onDropdownOpened}
@focusout=${(e: FocusEvent) =>
!['umb-entity-action-list', 'uui-scroll-container'].includes((e.relatedTarget as HTMLElement)?.tagName.toLowerCase() || '')
&& this.#onActionExecuted()
}
.label=${this.label}
?compact=${this.compact}
hide-expand>
Expand Down
2 changes: 1 addition & 1 deletion src/Umbraco.Web.UI/appsettings.Development.template.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
]
},
"Umbraco": {
"CMS": {
"CMS":
"Examine": {
"LuceneDirectoryFactory": "TempFileSystemDirectoryFactory"
},
Expand Down
Loading