ACS-11160: improve context menu overlay service implementation (#11661)

* refactor: improve context menu overlay service implementation

- Introduced a new interface for overlay references with backdrop handling.
- Updated event listener for backdrop clicks to use the new interface, enhancing type safety.
- Refactored the injector creation method to utilize the Injector.create method for better clarity and maintainability.
- Improved the fake element's type definition in the getOverlayConfig method for better type inference.

These changes enhance the overall robustness and readability of the context menu overlay service.

* refactor: enhance type safety in context menu components

- Introduced the ContextMenuItem interface to improve type definitions for context menu items.
- Updated the ContextMenuListComponent to use ContextMenuItem for links and menu item parameters, enhancing clarity and maintainability.
- Modified CONTEXT_MENU_DATA injection token to specify ContextMenuItem[] for better type safety.
- Adjusted the ContextMenuOverlayConfig interface to accept an array of ContextMenuItem, ensuring consistent data handling.

These changes improve the overall robustness and readability of the context menu implementation.
[ci:force]

* refactor: remove unnecessary eslint-disable comments in category management and search components

- Eliminated eslint-disable comments related to no-underscore-dangle in the CategoriesManagementComponent and SearchControlComponent tests, improving code clarity and adherence to linting rules.
- This change enhances the overall readability of the test files by ensuring consistent coding standards.

* refactor: simplify backdrop click handling in context menu overlay service

- Removed the unnecessary backdrop click handling logic, replacing it with a direct call to close the overlay reference. This change enhances code clarity and reduces complexity in the event listener implementation.

* refactor: streamline backdrop handling in context menu overlay service

- Removed the custom interface for overlay references with backdrop handling, simplifying the code.
- Updated the event listener for backdrop clicks to directly use the overlay's backdropElement, enhancing clarity and maintainability.
- This change improves the overall robustness of the context menu overlay service.
This commit is contained in:
Denys Vuika
2026-02-17 13:18:41 +00:00
committed by GitHub
parent 1f49af4c8f
commit fafa5d6c41
5 changed files with 45 additions and 26 deletions
@@ -328,7 +328,6 @@ describe('CategoriesManagementComponent', () => {
const categoriesChangeSpy = spyOn(component.categoriesChange, 'emit').and.callThrough();
typeCategory('test');
const options = getExistingCategoriesList();
// eslint-disable-next-line no-underscore-dangle
options[0].click();
expect(component.categories.length).toBe(3);
@@ -342,7 +341,6 @@ describe('CategoriesManagementComponent', () => {
it('should remove selected category from categories list and add it back to existing categories', fakeAsync(() => {
typeCategory('test');
const options = getExistingCategoriesList();
// eslint-disable-next-line no-underscore-dangle
options[0].click();
fixture.detectChanges();