OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Revert "Merge pull request #11505 from opf/feat/44344-modal-trap-focus"
ulferts06ffc5a2325f
diff --git a/app/views/layouts/base.html.erb b/app/views/layouts/base.html.erbindex 2550240cb0c..8694ab0dd47 100644--- a/app/views/layouts/base.html.erb+++ b/app/views/layouts/base.html.erb@@ -59,7 +59,6 @@ See COPYRIGHT and LICENSE files for more details.</div></noscript><op-toasts-container></op-toasts-container>-<op-modal-overlay></op-modal-overlay><% main_menu = render_main_menu(local_assigns.fetch(:menu_name, nil), @project) %><% side_displayed = content_for?(:sidebar) || content_for?(:main_menu) || !main_menu.blank? %><% initial_classes = initial_menu_classes(side_displayed, show_decoration) %>diff --git a/frontend/src/app/app.module.ts b/frontend/src/app/app.module.tsindex dd1c4f27837..c978f2bd0ec 100644--- a/frontend/src/app/app.module.ts+++ b/frontend/src/app/app.module.ts@@ -93,7 +93,6 @@ import { OpenProjectDirectFileUploadService } from './core/file-upload/op-directimport { OpenProjectStateModule } from 'core-app/core/state/openproject-state.module';import { OpenprojectContentLoaderModule } from 'core-app/shared/components/op-content-loader/openproject-content-loader.module';import { OpenProjectHeaderInterceptor } from 'core-app/features/hal/http/openproject-header-interceptor';-import { A11yModule } from '@angular/cdk/a11y';export function initializeServices(injector:Injector) {return () => {@@ -115,8 +114,6 @@ export function initializeServices(injector:Injector) {imports: [// The BrowserModule must only be loaded here!BrowserModule,- A11yModule,-// CommonsOPSharedModule,// Design Systemdiff --git a/frontend/src/app/core/setup/global-dynamic-components.const.ts b/frontend/src/app/core/setup/global-dynamic-components.const.tsindex 93893c28527..3c02c6cc893 100644--- a/frontend/src/app/core/setup/global-dynamic-components.const.ts+++ b/frontend/src/app/core/setup/global-dynamic-components.const.ts@@ -199,7 +199,6 @@ import {CalendarSidemenuComponent,opCalendarSidemenuSelector,} from 'core-app/features/calendar/sidemenu/calendar-sidemenu.component';-import { OpModalOverlayComponent, opModalOverlaySelector } from 'core-app/shared/components/modal/modal-overlay.component';export const globalDynamicComponents:OptionalBootstrapDefinition[] = [{ selector: appBaseSelector, cls: ApplicationBaseComponent },@@ -255,5 +254,4 @@ export const globalDynamicComponents:OptionalBootstrapDefinition[] = [{ selector: backupSelector, cls: BackupComponent },{ selector: opInAppNotificationBellSelector, cls: InAppNotificationBellComponent },{ selector: ianMenuSelector, cls: IanMenuComponent },- { selector: opModalOverlaySelector, cls: OpModalOverlayComponent },];diff --git a/frontend/src/app/core/setup/globals/global-listeners/preview-trigger.service.ts b/frontend/src/app/core/setup/globals/global-listeners/preview-trigger.service.tsindex 3b6d7c5191e..735c73006c5 100644--- a/frontend/src/app/core/setup/globals/global-listeners/preview-trigger.service.ts+++ b/frontend/src/app/core/setup/globals/global-listeners/preview-trigger.service.ts@@ -32,6 +32,8 @@ import { WpPreviewModalComponent } from 'core-app/shared/components/modals/previ@Injectable({ providedIn: 'root' })export class PreviewTriggerService {+ private previewModal:WpPreviewModalComponent;+private modalElement:HTMLElement;private mouseInModal = false;@@ -52,15 +54,14 @@ export class PreviewTriggerService {return;}- this.opModalService.show(+ this.previewModal = this.opModalService.show(WpPreviewModalComponent,this.injector,{ workPackageLink: href, event: e },true,- ).subscribe((previewModal) => {- this.modalElement = previewModal.elementRef.nativeElement as HTMLElement;- previewModal.reposition(jQuery(this.modalElement), el);- });+ );+ this.modalElement = this.previewModal.elementRef.nativeElement;+ this.previewModal.reposition(jQuery(this.modalElement), el);});jQuery(document.body).on('mouseleave', '.preview-trigger', () => {diff --git a/frontend/src/app/core/setup/globals/global-listeners/request-for-confirmation.ts b/frontend/src/app/core/setup/globals/global-listeners/request-for-confirmation.tsindex 5386c79cea5..e830fa46b96 100644--- a/frontend/src/app/core/setup/globals/global-listeners/request-for-confirmation.ts+++ b/frontend/src/app/core/setup/globals/global-listeners/request-for-confirmation.ts@@ -33,7 +33,7 @@ function registerListener(form:JQuery,$event:JQuery.TriggeredEvent,opModalService:OpModalService,- passwordModal:typeof PasswordConfirmationModalComponent,+ modal:typeof PasswordConfirmationModalComponent,) {const passwordConfirm = form.find('_password_confirmation');@@ -42,22 +42,20 @@ function registerListener(}$event.preventDefault();- opModalService.show(passwordModal, 'global')- .subscribe((modal) => modal.closingEvent.subscribe(() => {- if (!modal.confirmed) {- return;- }-+ const modalComponent = opModalService.show(modal, 'global');+ modalComponent.closingEvent.subscribe((confirmModal:any) => {+ if (confirmModal.confirmed) {jQuery('<input>').attr({type: 'hidden',name: '_password_confirmation',- value: modal.password_confirmation,+ value: confirmModal.password_confirmation,}).appendTo(form);form.trigger('submit');- }));+ }+ });return false;}diff --git a/frontend/src/app/features/boards/board/configuration-modal/board-configuration.modal.ts b/frontend/src/app/features/boards/board/configuration-modal/board-configuration.modal.tsindex a3b42f8960b..bcd4e4f9b84 100644--- a/frontend/src/app/features/boards/board/configuration-modal/board-configuration.modal.ts+++ b/frontend/src/app/features/boards/board/configuration-modal/board-configuration.modal.ts@@ -61,7 +61,7 @@ export class BoardConfigurationModalComponent extends OpModalComponent implement}ngOnInit() {- this.$element = this.elementRef.nativeElement as HTMLElement;+ this.$element = jQuery(this.elementRef.nativeElement);this.tabPortalHost = new TabPortalOutlet(this.boardConfigurationService.tabs,@@ -116,7 +116,7 @@ export class BoardConfigurationModalComponent extends OpModalComponent implementreturn true;}- protected get afterFocusOn():HTMLElement {+ protected get afterFocusOn():JQuery {return this.$element;}}diff --git a/frontend/src/app/features/invite-user-modal/invite-user-modal-augment.service.ts b/frontend/src/app/features/invite-user-modal/invite-user-modal-augment.service.tsindex 452b675f1bd..986edd490e4 100644--- a/frontend/src/app/features/invite-user-modal/invite-user-modal-augment.service.ts+++ b/frontend/src/app/features/invite-user-modal/invite-user-modal-augment.service.ts@@ -61,17 +61,19 @@ export class OpInviteUserModalAugmentService {private spawnModal(event:ClickEvent) {event.preventDefault();- this.opModalService.show(+ const modal = this.opModalService.show(InviteUserModalComponent,'global',{ projectId: this.currentProjectService.id },- ).subscribe((modal) => modal+ );++ modal.closingEvent.subscribe((modal:InviteUserModalComponent) => {// Just reload the page for now if we saved anythingif (modal.data) {window.location.reload();}- }));+ });}}diff --git a/frontend/src/app/features/invite-user-modal/invite-user-modal.service.ts b/frontend/src/app/features/invite-user-modal/invite-user-modal.service.tsindex f3c4d73fe5e..d454838610a 100644--- a/frontend/src/app/features/invite-user-modal/invite-user-modal.service.ts+++ b/frontend/src/app/features/invite-user-modal/invite-user-modal.service.ts@@ -47,14 +47,16 @@ export class OpInviteUserModalService {}public open(projectId:string|null = this.currentProjectService.id) {- this.opModalService.show(+ const modal = this.opModalService.show(InviteUserModalComponent,'global',{ projectId },- ).subscribe((modal) => modal+ );++ modal.closingEvent.subscribe((modal:InviteUserModalComponent) => {this.close.emit(modal.data);- }));+ });}}diff --git a/frontend/src/app/features/job-status/display-job-page/display-job-page.component.ts b/frontend/src/app/features/job-status/display-job-page/display-job-page.component.tsindex 795838f5410..e685d23eb4c 100644--- a/frontend/src/app/features/job-status/display-job-page/display-job-page.component.ts+++ b/frontend/src/app/features/job-status/display-job-page/display-job-page.component.ts@@ -3,6 +3,7 @@ import {} from '@angular/core';import { StateService } from '@uirouter/core';import { OpModalService } from 'core-app/shared/components/modal/modal.service';+import { OpModalComponent } from 'core-app/shared/components/modal/modal.component';import { JobStatusModalComponent } from 'core-app/features/job-status/job-status-modal/job-status.modal';import { take } from 'rxjs/operators';@@ -10,23 +11,25 @@ import { take } from 'rxjs/operators';template: '',})export class DisplayJobPageComponent implements AfterViewInit, OnDestroy {+ private modal?:OpModalComponent;+constructor(private $state:StateService,private modalService:OpModalService) {}ngAfterViewInit() {- this.modalService.show(JobStatusModalComponent, 'global', { jobId: this.$state.params.jobId })- .subscribe((modal) => modal- .closingEvent- .pipe(- take(1),- ).subscribe(() => {- // Go back in history- window.history.back();- }));+ this.modal = this.modalService.show(JobStatusModalComponent, 'global', { jobId: this.$state.params.jobId });+ this.modal+ .closingEvent+ .pipe(+ take(1),+ ).subscribe(() => {+ // Go back in history+ window.history.back();+ });}ngOnDestroy() {- this.modalService.close();+ this.modal?.closeMe();}}diff --git a/frontend/src/app/features/work-packages/components/wp-table/config-menu/config-menu.component.ts b/frontend/src/app/features/work-packages/components/wp-table/config-menu/config-menu.component.tsindex 801308c8b5d..a53930376cd 100644--- a/frontend/src/app/features/work-packages/components/wp-table/config-menu/config-menu.component.ts+++ b/frontend/src/app/features/work-packages/components/wp-table/config-menu/config-menu.component.ts@@ -1,5 +1,5 @@import { I18nService } from 'core-app/core/i18n/i18n.service';-import { Component, Injector } from '@angular/core';+import { Component, OnInit, Injector } from '@angular/core';import { OpModalService } from 'core-app/shared/components/modal/modal.service';import { OPContextMenuService } from 'core-app/shared/components/op-context-menu/op-context-menu.service';import { WpTableConfigurationModalComponent } from 'core-app/features/work-packages/components/wp-table/configuration-modal/wp-table-configuration.modal';@@ -8,17 +8,20 @@ import { WpTableConfigurationModalComponent } from 'core-app/features/work-packatemplateUrl: './config-menu.template.html',selector: 'wp-table-config-menu',})-export class WorkPackagesTableConfigMenuComponent {- public text = {- configureTable: this.I18n.t('js.toolbar.settings.configure_view'),- };+export class WorkPackagesTableConfigMenuComponent implements OnInit {+ public text:any;- constructor(- readonly I18n:I18nService,+ constructor(readonly I18n:I18nService,readonly injector:Injector,readonly opModalService:OpModalService,- readonly opContextMenu:OPContextMenuService,- ) { }+ readonly opContextMenu:OPContextMenuService) {+ }++ ngOnInit():void {+ this.text = {+ configureTable: I18n.t('js.toolbar.settings.configure_view'),+ };+ }public openTableConfigurationModal() {this.opContextMenu.close();diff --git a/frontend/src/app/features/work-packages/components/wp-table/configuration-modal/wp-table-configuration.modal.ts b/frontend/src/app/features/work-packages/components/wp-table/configuration-modal/wp-table-configuration.modal.tsindex acd11707d5b..c688f3d0e18 100644--- a/frontend/src/app/features/work-packages/components/wp-table/configuration-modal/wp-table-configuration.modal.ts+++ b/frontend/src/app/features/work-packages/components/wp-table/configuration-modal/wp-table-configuration.modal.ts@@ -45,6 +45,8 @@ export class WpTableConfigurationModalComponent extends OpModalComponent impleme/* Close on outside click */public closeOnOutsideClick = false;+ public $element:JQuery;+public text = {title: this.I18n.t('js.work_packages.table_configuration.modal_title'),closePopup: this.I18n.t('js.close_popup_title'),@@ -92,7 +94,7 @@ export class WpTableConfigurationModalComponent extends OpModalComponent impleme}ngOnInit() {- this.$element = this.elementRef.nativeElement as HTMLElement;+ this.$element = jQuery(this.elementRef.nativeElement);this.tabPortalHost = new TabPortalOutlet(this.wpTableConfigurationService.tabs,@@ -146,7 +148,7 @@ export class WpTableConfigurationModalComponent extends OpModalComponent implemereturn true;}- protected get afterFocusOn():HTMLElement {+ protected get afterFocusOn():JQuery {return this.$element;}diff --git a/frontend/src/app/features/work-packages/components/wp-table/embedded/wp-embedded-table.component.ts b/frontend/src/app/features/work-packages/components/wp-table/embedded/wp-embedded-table.component.tsindex 91abe2b09dd..7cca4bc3e72 100644--- a/frontend/src/app/features/work-packages/components/wp-table/embedded/wp-embedded-table.component.ts+++ b/frontend/src/app/features/work-packages/components/wp-table/embedded/wp-embedded-table.component.ts@@ -88,13 +88,16 @@ export class WorkPackageEmbeddedTableComponent extends WorkPackageEmbeddedBaseCo});}- public async openConfigurationModal(onUpdated:() => void):Promise<void> {- await this.querySpace.query.valuesPromise();-- this.opModalService- .show(WpTableConfigurationModalComponent, this.injector)- // Detach this component when the modal closes and pass along the query data- .subscribe((modal) => modal.onDataUpdated.subscribe(onUpdated));+ public openConfigurationModal(onUpdated:() => void) {+ this.querySpace.query+ .valuesPromise()+ .then(() => {+ const modal = this.opModalService+ .show(WpTableConfigurationModalComponent, this.injector);++ // Detach this component when the modal closes and pass along the query data+ modal.onDataUpdated.subscribe(onUpdated);+ });}protected initializeStates(query:QueryResource) {diff --git a/frontend/src/app/features/work-packages/routing/partitioned-query-space-page/partitioned-query-space-page.component.ts b/frontend/src/app/features/work-packages/routing/partitioned-query-space-page/partitioned-query-space-page.component.tsindex 90e51747cb6..c13882a4212 100644--- a/frontend/src/app/features/work-packages/routing/partitioned-query-space-page/partitioned-query-space-page.component.ts+++ b/frontend/src/app/features/work-packages/routing/partitioned-query-space-page/partitioned-query-space-page.component.ts@@ -257,7 +257,10 @@ export class PartitionedQuerySpacePageComponent extends WorkPackagesViewBase impprotected inviteModal = InviteUserModalComponent;openInviteUserModal():void {- this.opModalService.show(this.inviteModal, 'global');+ const inviteModal = this.opModalService.show(this.inviteModal, 'global');+ inviteModal.closingEvent.subscribe((modal:any) => {+ console.log('Modal closed!', modal);+ });}protected loadQuery(firstPage = false):Promise<QueryResource> {diff --git a/frontend/src/app/shared/components/attribute-help-texts/attribute-help-text.modal.ts b/frontend/src/app/shared/components/attribute-help-texts/attribute-help-text.modal.tsindex 0245e99d05c..b0833126183 100644--- a/frontend/src/app/shared/components/attribute-help-texts/attribute-help-text.modal.ts+++ b/frontend/src/app/shared/components/attribute-help-texts/attribute-help-text.modal.ts@@ -53,12 +53,10 @@ export class AttributeHelpTextModalComponent extends OpModalComponent implementspublic helpText:HelpTextResource = this.locals.helpText!;- constructor(- @Inject(OpModalLocalsToken) public locals:OpModalLocalsMap,+ constructor(@Inject(OpModalLocalsToken) public locals:OpModalLocalsMap,readonly I18n:I18nService,readonly cdRef:ChangeDetectorRef,- readonly elementRef:ElementRef,- ) {+ readonly elementRef:ElementRef) {super(locals, cdRef, elementRef);}diff --git a/frontend/src/app/shared/components/attribute-help-texts/help-text.modal.html b/frontend/src/app/shared/components/attribute-help-texts/help-text.modal.htmlindex cf960dc6651..a0251f605b0 100644--- a/frontend/src/app/shared/components/attribute-help-texts/help-text.modal.html+++ b/frontend/src/app/shared/components/attribute-help-texts/help-text.modal.html@@ -28,21 +28,20 @@<div class="spot-action-bar--right"><buttontype="button"- class="button spot-action-bar--action spot-modal--cancel-button"+ class="button button_no-margin spot-action-bar--action spot-modal--cancel-button"(click)="closeMe()">{{ text.close }}</button>- <button- class="help-text--edit-button button spot-action-bar--action"+ <a+ class="help-text--edit-button button button_no-margin spot-action-bar--action"*ngIf="helpText.editText"[attr.href]="helpTextLink"[attr.title]="text.edit"- type="button"><op-icon icon-classes="button--icon icon-edit"></op-icon><span class="button--text" [textContent]="text.edit"></span>- </button>+ </a></div></div></div>diff --git a/frontend/src/app/shared/components/fields/edit/field-types/combined-date-edit-field.component.ts b/frontend/src/app/shared/components/fields/edit/field-types/combined-date-edit-field.component.tsindex d2cd8ee08d6..1b02baeea93 100644--- a/frontend/src/app/shared/components/fields/edit/field-types/combined-date-edit-field.component.ts+++ b/frontend/src/app/shared/components/fields/edit/field-types/combined-date-edit-field.component.ts@@ -50,7 +50,7 @@ export class CombinedDateEditFieldComponent extends DatePickerEditFieldComponentthis.modal- ?.onDataUpdated+ .onDataUpdated.subscribe((dates:string) => {this.dates = dates;this.cdRef.detectChanges();diff --git a/frontend/src/app/shared/components/fields/edit/field-types/date-picker-edit-field.component.ts b/frontend/src/app/shared/components/fields/edit/field-types/date-picker-edit-field.component.tsindex cff71a024c0..28a2d840af9 100644--- a/frontend/src/app/shared/components/fields/edit/field-types/date-picker-edit-field.component.ts+++ b/frontend/src/app/shared/components/fields/edit/field-types/date-picker-edit-field.component.ts@@ -49,7 +49,7 @@ export abstract class DatePickerEditFieldComponent extends EditFieldComponent im@InjectField() deviceService:DeviceService;- protected modal:SingleDateModalComponent|MultiDateModalComponent|null = null;+ protected modal:SingleDateModalComponent|MultiDateModalComponent;ngOnInit():void {super.ngOnInit();@@ -71,28 +71,29 @@ export abstract class DatePickerEditFieldComponent extends EditFieldComponent impublic showDatePickerModal():void {const component = this.change.schema.isMilestone ? SingleDateModalComponent : MultiDateModalComponent;- this.opModalService.show<SingleDateModalComponent|MultiDateModalComponent>(- component,- this.injector,- { changeset: this.change, fieldName: this.name },- !this.deviceService.isMobile,- ).subscribe((modal) => {- this.modal = modal;+ this.modal = this+ .opModalService+ .show<SingleDateModalComponent|MultiDateModalComponent>(+ component,+ this.injector,+ { changeset: this.change, fieldName: this.name },+ !this.deviceService.isMobile,+ );- setTimeout(() => {- const modalElement = jQuery(modal.elementRef.nativeElement).find('.op-datepicker-modal');- const field = jQuery(this.elementRef.nativeElement);- modal.reposition(modalElement, field);- });+ const { modal } = this;- (modal as OpModalComponent)- .closingEvent- .pipe(take(1))- .subscribe(() => {- this.modal = null;- this.onModalClosed();- });+ setTimeout(() => {+ const modalElement = jQuery(modal.elementRef.nativeElement).find('.op-datepicker-modal');+ const field = jQuery(this.elementRef.nativeElement);+ modal.reposition(modalElement, field);});++ (modal as OpModalComponent)+ .closingEvent+ .pipe(take(1))+ .subscribe(() => {+ this.onModalClosed();+ });}protected onModalClosed():void {diff --git a/frontend/src/app/shared/components/grids/grid/add-widget.service.ts b/frontend/src/app/shared/components/grids/grid/add-widget.service.tsindex ac5cd60a7e1..b6d84713deb 100644--- a/frontend/src/app/shared/components/grids/grid/add-widget.service.ts+++ b/frontend/src/app/shared/components/grids/grid/add-widget.service.ts@@ -58,35 +58,30 @@ export class GridAddWidgetService {private select(area:GridArea) {return new Promise<GridWidgetResource>((resolve, reject) => {- this.opModalService.show(- AddGridWidgetModalComponent,- this.injector,- { schema: this.layout.schema },- ).subscribe((modal) => {- modal.closingEvent.subscribe(() => {- const registered = modal.chosenWidget;-- if (!registered) {- reject();- return;- }-- const source = {- _type: 'GridWidget',- identifier: registered.identifier,- startRow: area.startRow,- endRow: area.endRow,- startColumn: area.startColumn,- endColumn: area.endColumn,- options: registered.properties || {},- };-- const resource:GridWidgetResource = this.halResource.createHalResource(source);-- resource.grid = this.layout.gridResource;-- resolve(resource);- });+ const modal = this.opModalService.show(AddGridWidgetModalComponent, this.injector, { schema: this.layout.schema });+ modal.closingEvent.subscribe((modal:AddGridWidgetModalComponent) => {+ const registered = modal.chosenWidget;++ if (!registered) {+ reject();+ return;+ }++ const source = {+ _type: 'GridWidget',+ identifier: registered.identifier,+ startRow: area.startRow,+ endRow: area.endRow,+ startColumn: area.startColumn,+ endColumn: area.endColumn,+ options: registered.properties || {},+ };++ const resource:GridWidgetResource = this.halResource.createHalResource(source);++ resource.grid = this.layout.gridResource;++ resolve(resource);});});}diff --git a/frontend/src/app/shared/components/grids/grid/grid.component.ts b/frontend/src/app/shared/components/grids/grid/grid.component.tsindex bd2ff29c2ac..dbfc198fe6d 100644--- a/frontend/src/app/shared/components/grids/grid/grid.component.ts+++ b/frontend/src/app/shared/components/grids/grid/grid.component.ts@@ -20,7 +20,7 @@ export interface WidgetRegistration {identifier:string;title:string;component:{ new (...args:any[]):AbstractWidgetComponent };- properties?:Record<string, unknown>;+ properties?:any;}export const GRID_PROVIDERS = [diff --git a/frontend/src/app/shared/components/grids/widgets/add/add.modal.html b/frontend/src/app/shared/components/grids/widgets/add/add.modal.htmlindex 1273f255313..6f7848e3d60 100644--- a/frontend/src/app/shared/components/grids/widgets/add/add.modal.html+++ b/frontend/src/app/shared/components/grids/widgets/add/add.modal.html@@ -1,5 +1,9 @@<divclass="spot-modal loading-indicator--location"+ tabindex="0"+ cdkFocusInitial+ cdkTrapFocus+ [cdkTrapFocusAutoCapture]="true"data-indicator-name="modal"><div class="spot-modal--header">{{text.title}}</div>diff --git a/frontend/src/app/shared/components/grids/widgets/menu/wp-set-menu.component.ts b/frontend/src/app/shared/components/grids/widgets/menu/wp-set-menu.component.tsindex 04a3bcc6803..a958042e554 100644--- a/frontend/src/app/shared/components/grids/widgets/menu/wp-set-menu.component.ts+++ b/frontend/src/app/shared/components/grids/widgets/menu/wp-set-menu.component.ts@@ -31,16 +31,16 @@ import {} from '@angular/core';import { I18nService } from 'core-app/core/i18n/i18n.service';import { OpModalService } from 'core-app/shared/components/modal/modal.service';+import { OpModalComponent } from 'core-app/shared/components/modal/modal.component';import { GridRemoveWidgetService } from 'core-app/shared/components/grids/grid/remove-widget.service';import { ComponentType } from '@angular/cdk/portal';import { WidgetAbstractMenuComponent } from 'core-app/shared/components/grids/widgets/menu/widget-abstract-menu.component';import { WpGraphConfigurationModalComponent } from 'core-app/shared/components/work-package-graphs/configuration-modal/wp-graph-configuration.modal';import { GridAreaService } from 'core-app/shared/components/grids/grid/area.service';-import { WpTableConfigurationModalComponent } from 'core-app/features/work-packages/components/wp-table/configuration-modal/wp-table-configuration.modal';@Directive()export abstract class WidgetWpSetMenuComponent extends WidgetAbstractMenuComponent {- protected configurationComponent:ComponentType<WpGraphConfigurationModalComponent|WpTableConfigurationModalComponent>;+ protected configurationComponent:ComponentType<OpModalComponent>;@Output()onConfigured:EventEmitter<any> = new EventEmitter();@@ -64,13 +64,10 @@ export abstract class WidgetWpSetMenuComponent extends WidgetAbstractMenuComponereturn {linkText: this.i18n.t('js.toolbar.settings.configure_view'),onClick: () => {- this.opModalService- .show(this.configurationComponent, this.injector, this.locals)- .subscribe((modal) => modal.closingEvent.subscribe(() => {- if (modal instanceof WpGraphConfigurationModalComponent) {- this.onConfigured.emit(modal.configuration);- }- }));+ this.opModalService.show(this.configurationComponent, this.injector, this.locals)+ .closingEvent.subscribe((modal:WpGraphConfigurationModalComponent) => {+ this.onConfigured.emit(modal.configuration);+ });return true;},};diff --git a/frontend/src/app/shared/components/grids/widgets/time-entries/current-user/configuration-modal/configuration.modal.ts b/frontend/src/app/shared/components/grids/widgets/time-entries/current-user/configuration-modal/configuration.modal.tsindex 3117d4c3e96..9af4d6a40e6 100644--- a/frontend/src/app/shared/components/grids/widgets/time-entries/current-user/configuration-modal/configuration.modal.ts+++ b/frontend/src/app/shared/components/grids/widgets/time-entries/current-user/configuration-modal/configuration.modal.ts@@ -21,6 +21,8 @@ export class TimeEntriesCurrentUserConfigurationModalComponent extends OpModalCo/* Close on outside click */public closeOnOutsideClick = true;+ public $element:JQuery;+public text = {displayedDays: this.I18n.t('js.grid.widgets.time_entries_current_user.displayed_days'),closePopup: this.I18n.t('js.close_popup_title'),diff --git a/frontend/src/app/shared/components/grids/widgets/time-entries/current-user/time-entries-current-user-menu.component.ts b/frontend/src/app/shared/components/grids/widgets/time-entries/current-user/time-entries-current-user-menu.component.tsindex ec52f4bf841..8534cae1192 100644--- a/frontend/src/app/shared/components/grids/widgets/time-entries/current-user/time-entries-current-user-menu.component.ts+++ b/frontend/src/app/shared/components/grids/widgets/time-entries/current-user/time-entries-current-user-menu.component.ts@@ -64,13 +64,11 @@ export class WidgetTimeEntriesCurrentUserMenuComponent extends WidgetAbstractMenlinkText: this.i18n.t('js.grid.configure'),onClick: () => {this.opModalService.show(TimeEntriesCurrentUserConfigurationModalComponent, this.injector, this.locals)- .subscribe(- (modal) => modal.closingEvent.subscribe(() => {- if (modal.options) {- this.onConfigured.emit(modal.options);- }- }),- );+ .closingEvent.subscribe((modal:TimeEntriesCurrentUserConfigurationModalComponent) => {+ if (modal.options) {+ this.onConfigured.emit(modal.options);+ }+ });return true;},};diff --git a/frontend/src/app/shared/components/modal/modal-overlay.component.html b/frontend/src/app/shared/components/modal/modal-overlay.component.htmldeleted file mode 100644index 70fd959d7c5..00000000000--- a/frontend/src/app/shared/components/modal/modal-overlay.component.html+++ /dev/null@@ -1,21 +0,0 @@-<div- class="spot-modal-overlay"- [ngClass]="{- 'spot-modal-overlay_active': (activeModalRef$ | async) !== null,- 'spot-modal-overlay_not-full-screen': notFullscreen- }"- #overlay- tabindex="0"- cdkFocusInitial- cdkTrapFocus- (click)="close()"->- <button- type="button"- class="spot-button spot-modal-overlay--close-button"- (click)="close()"- >- <span class="spot-icon spot-icon_close"></span>- </button>- <ng-template cdkPortalOutlet></ng-template>-</div>diff --git a/frontend/src/app/shared/components/modal/modal-overlay.component.ts b/frontend/src/app/shared/components/modal/modal-overlay.component.tsdeleted file mode 100644index 089ff215a7a..00000000000--- a/frontend/src/app/shared/components/modal/modal-overlay.component.ts+++ /dev/null@@ -1,121 +0,0 @@-// -- copyright-// OpenProject is an open source project management software.-// Copyright (C) 2012-2022 the OpenProject GmbH-//-// This program is free software; you can redistribute it and/or-// modify it under the terms of the GNU General Public License version 3.-//-// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-// Copyright (C) 2006-2013 Jean-Philippe Lang-// Copyright (C) 2010-2013 the ChiliProject Team-//-// This program is free software; you can redistribute it and/or-// modify it under the terms of the GNU General Public License-// as published by the Free Software Foundation; either version 2-// of the License, or (at your option) any later version.-//-// This program is distributed in the hope that it will be useful,-// but WITHOUT ANY WARRANTY; without even the implied warranty of-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-// GNU General Public License for more details.-//-// You should have received a copy of the GNU General Public License-// along with this program; if not, write to the Free Software-// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.-//-// See COPYRIGHT and LICENSE files for more details.-//++--import {- ChangeDetectionStrategy,- Component,- ComponentRef,- ElementRef,- OnInit,- ViewChild,-} from '@angular/core';-import {- CdkPortalOutlet,- ComponentPortal,-} from '@angular/cdk/portal';-import { I18nService } from 'core-app/core/i18n/i18n.service';-import { OpModalService } from 'core-app/shared/components/modal/modal.service';-import { OpModalComponent } from './modal.component';-import { ReplaySubject } from 'rxjs';--export const opModalOverlaySelector = 'op-modal-overlay';--@Component({- selector: opModalOverlaySelector,- templateUrl: './modal-overlay.component.html',- changeDetection: ChangeDetectionStrategy.OnPush,-})-export class OpModalOverlayComponent implements OnInit {- public notFullscreen = false;-- @ViewChild(CdkPortalOutlet) portalOutlet:CdkPortalOutlet;-- @ViewChild('overlay') overlay:ElementRef;-- activeModalData$ = this.modalService.activeModalData$;-- activeModalInstance$ = this.modalService.activeModalInstance$;-- activeModalRef$ = new ReplaySubject<OpModalComponent|null>();-- constructor(- readonly modalService:OpModalService,- readonly I18n:I18nService,- ) { }-- ngOnInit():void {- this.activeModalData$- .subscribe((modalData) => {- this.notFullscreen = false;-- if (modalData === null) {- const ref = (this.portalOutlet.attachedRef as ComponentRef<OpModalComponent>);- if (!ref) {- return;- }-- if (!ref.instance.onClose()) {- return;- }-- ref.instance.closingEvent.emit(ref.instance);- this.activeModalRef$.next(null);- this.activeModalInstance$.next(null);-- this.portalOutlet.detach();-- return;- }-- const {- modal,- injector,- notFullscreen,- } = modalData;- this.notFullscreen = notFullscreen;- const portal = new ComponentPortal(modal, null, injector);- const ref = this.portalOutlet.attach(portal);- const instance = ref.instance;- this.activeModalRef$.next(instance);-- this.activeModalInstance$.next(instance);- setTimeout(() => {- (this.overlay.nativeElement as HTMLElement).focus();- // Focus on the first element- instance && instance.onOpen();-- // Trigger another round of change detection in the modal- ref.changeDetectorRef.detectChanges();- }, 0);- });- }-- public close():void {- this.modalService.close();- }-}diff --git a/frontend/src/app/shared/components/modal/modal-wrapper-augment.service.ts b/frontend/src/app/shared/components/modal/modal-wrapper-augment.service.tsindex 6861f6eda60..e6cea7faaba 100644--- a/frontend/src/app/shared/components/modal/modal-wrapper-augment.service.ts+++ b/frontend/src/app/shared/components/modal/modal-wrapper-augment.service.ts@@ -39,11 +39,10 @@ const iframeSelector = '.iframe-target-wrapper';*/@Injectable({ providedIn: 'root' })export class OpModalWrapperAugmentService {- constructor(- @Inject(DOCUMENT) protected documentElement:Document,+ constructor(@Inject(DOCUMENT) protected documentElement:Document,protected injector:Injector,- protected opModalService:OpModalService,- ) {}+ protected opModalService:OpModalService) {+ }/*** Create initial listeners for Rails-rendered modalsdiff --git a/frontend/src/app/shared/components/modal/modal.component.ts b/frontend/src/app/shared/components/modal/modal.component.tsindex 6e41e6103ec..921003ef866 100644--- a/frontend/src/app/shared/components/modal/modal.component.ts+++ b/frontend/src/app/shared/components/modal/modal.component.ts@@ -18,7 +18,7 @@ export abstract class OpModalComponent extends UntilDestroyedMixin implements On/* Reference to service */protected service:OpModalService = this.locals.service;- public $element:HTMLElement;+ public $element:JQuery;/** Closing event called from the service when closing this modal */public closingEvent = new EventEmitter<this>();@@ -28,16 +28,14 @@ export abstract class OpModalComponent extends UntilDestroyedMixin implements On/* Data to be return from this modal instance */public data:unknown;- protected constructor(- public locals:OpModalLocalsMap,+ protected constructor(public locals:OpModalLocalsMap,readonly cdRef:ChangeDetectorRef,- readonly elementRef:ElementRef,- ) {+ readonly elementRef:ElementRef) {super();}ngOnInit() {- this.$element = this.elementRef.nativeElement as HTMLElement;+ this.$element = jQuery(this.elementRef.nativeElement);}ngOnDestroy() {@@ -69,7 +67,7 @@ export abstract class OpModalComponent extends UntilDestroyedMixin implements Onthis.cdRef.detectChanges();}- protected get afterFocusOn():HTMLElement {+ protected get afterFocusOn():JQuery {return this.$element;}}diff --git a/frontend/src/app/shared/components/modal/modal.module.ts b/frontend/src/app/shared/components/modal/modal.module.tsindex 1936f283fa4..839d21c0f66 100644--- a/frontend/src/app/shared/components/modal/modal.module.ts+++ b/frontend/src/app/shared/components/modal/modal.module.ts@@ -1,24 +1,18 @@import { NgModule } from '@angular/core';import { CommonModule } from '@angular/common';-import { PortalModule } from '@angular/cdk/portal';-import { A11yModule } from '@angular/cdk/a11y';import { FocusModule } from 'core-app/shared/directives/focus/focus.module';import { IconModule } from 'core-app/shared/components/icon/icon.module';import { OpModalService } from './modal.service';import { OpModalWrapperAugmentService } from './modal-wrapper-augment.service';import { OpModalBannerComponent } from 'core-app/shared/components/modal/modal-banner/modal-banner.component';-import { OpModalOverlayComponent } from 'core-app/shared/components/modal/modal-overlay.component';@NgModule({imports: [CommonModule,FocusModule,IconModule,- PortalModule,- A11yModule,],exports: [- OpModalOverlayComponent,OpModalBannerComponent,],providers: [@@ -27,7 +21,6 @@ import { OpModalOverlayComponent } from 'core-app/shared/components/modal/modal-],declarations: [OpModalBannerComponent,- OpModalOverlayComponent,],})export class OpenprojectModalModule { }diff --git a/frontend/src/app/shared/components/modal/modal.service.ts b/frontend/src/app/shared/components/modal/modal.service.tsindex 070fc4034c8..843fab968ce 100644--- a/frontend/src/app/shared/components/modal/modal.service.ts+++ b/frontend/src/app/shared/components/modal/modal.service.ts@@ -27,39 +27,84 @@//++import {+ ApplicationRef,+ ComponentFactoryResolver,+ ComponentRef,Injectable,InjectionToken,Injector,} from '@angular/core';-import { ComponentType, PortalInjector } from '@angular/cdk/portal';+import {+ ComponentPortal,+ ComponentType,+ DomPortalOutlet,+ PortalInjector,+} from '@angular/cdk/portal';+import { TransitionService } from '@uirouter/core';import { OpModalComponent } from 'core-app/shared/components/modal/modal.component';-import { Observable, ReplaySubject } from 'rxjs';-import { filter, take } from 'rxjs/operators';export const OpModalLocalsToken = new InjectionToken<any>('OP_MODAL_LOCALS');@Injectable({ providedIn: 'root' })export class OpModalService {- public activeModalInstance$ = new ReplaySubject<OpModalComponent|null>(1);+ public active:OpModalComponent|null = null;++ // Hold a reference to the DOM node we're using as a host+ private readonly portalHostElement:HTMLElement;++ // And a reference to the actual portal host interface on top of the element+ private bodyPortalHost:DomPortalOutlet;- public activeModalData$ = new ReplaySubject<{- modal:ComponentType<OpModalComponent>,- injector:Injector,- notFullscreen:boolean,- }|null>(1);+ // Remember when we're opening a new modal to avoid the outside click bubbling up.+ private opening = false;constructor(+ private readonly componentFactoryResolver:ComponentFactoryResolver,+ private readonly appRef:ApplicationRef,+ private readonly $transitions:TransitionService,private readonly injector:Injector,) {+ const hostElement = document.createElement('div');+ hostElement.classList.add('spot-modal-overlay');+ document.body.appendChild(hostElement);++ const closeButton = document.createElement('button');+ closeButton.classList.add('spot-button', 'spot-modal-close-button');+ closeButton.innerHTML = '<span class="spot-icon spot-icon_close"></span>';+ hostElement.appendChild(closeButton);+// Listen to keystrokes on window to close context menuswindow.addEventListener('keydown', (evt:KeyboardEvent) => {- if (evt.key !== 'Escape') {- return;+ if (this.active && this.active.closeOnEscape && evt.key === 'Escape') {+ this.active.closeOnEscapeFunction();}+ return true;+ });- this.close();+ // Listen to any click on the modal overlay (backdrop click)+ hostElement.addEventListener('click', (evt:MouseEvent) => {+ if (this.active+ && !this.opening+ && this.portalHostElement === evt.target as Element) {+ this.close();+ }});++ closeButton.addEventListener('click', () => {+ if (this.active && !this.opening) {+ this.close();+ }+ });++ this.bodyPortalHost = new DomPortalOutlet(+ hostElement,+ this.componentFactoryResolver,+ this.appRef,+ this.injector,+ );++ this.portalHostElement = hostElement;}/**@@ -69,38 +114,63 @@ export class OpModalService {* @param injector The injector to pass into the component. Ensure this is the hierarchical injector if needed.* Can be passed 'global' to take the default (global!) injector of this service.* @param locals A map to be injected via token into the component.+ * @param notFullScreen Whether the modal is treated as non-overlay*/public show<T extends OpModalComponent>(modal:ComponentType<T>,injector:Injector|'global',locals:Record<string, unknown> = {},- notFullscreen = false,- ):Observable<T> {+ notFullScreen = false,+ ):T {this.close();+ // Prevent closing events during the opening time frame.+ this.opening = true;+// Allow users to pass the global injector when deliberately requested.if (injector === 'global') {injector = this.injector;}- this.activeModalData$.next({- modal,- injector: this.injectorFor(injector, locals),- notFullscreen,- });+ // Create a portal for the given component class and render it+ const portal = new ComponentPortal(modal, null, this.injectorFor(injector, locals));+ const ref:ComponentRef<OpModalComponent> = this.bodyPortalHost.attach(portal) as ComponentRef<OpModalComponent>;+ this.active = ref.instance as T;+ this.portalHostElement.classList.add('spot-modal-overlay_active');+ if (notFullScreen) {+ this.portalHostElement.classList.add('spot-modal-overlay_not-full-screen');+ }++ setTimeout(() => {+ // Focus on the first element+ this.active && this.active.onOpen();- return this.activeModalInstance$- .pipe(- filter((m) => m !== null),- take(1),- ) as Observable<T>;+ // Mark that we've opened the modal now+ this.opening = false;++ // Trigger another round of change detection in the modal+ ref.changeDetectorRef.detectChanges();+ }, 20);++ return this.active as T;+ }++ public isActive(modal:OpModalComponent):boolean {+ return this.active !== null && this.active === modal;}/*** Closes currently open modal window*/public close():void {- this.activeModalData$.next(null);+ // Detach any component currently in the portal+ if (this.active && this.active.onClose()) {+ this.active.closingEvent.emit(this.active);+ this.bodyPortalHost.detach();+ this.portalHostElement.classList.remove('spot-modal-overlay_active');+ this.portalHostElement.classList.remove('spot-modal-overlay_not-full-screen');+ this.active = null;+ }}/**diff --git a/frontend/src/app/shared/components/modals/confirm-dialog/confirm-dialog.service.ts b/frontend/src/app/shared/components/modals/confirm-dialog/confirm-dialog.service.tsindex e7e6b857dd0..df7e9764c5b 100644--- a/frontend/src/app/shared/components/modals/confirm-dialog/confirm-dialog.service.ts+++ b/frontend/src/app/shared/components/modals/confirm-dialog/confirm-dialog.service.ts@@ -61,17 +61,14 @@ export class ConfirmDialogService {*/public confirm(options:ConfirmDialogOptions):Promise<void> {return new Promise<void>((resolve, reject) => {- this.opModalService.show(- ConfirmDialogModalComponent,- this.injector,- { options },- ).subscribe((modal) => modal.closingEvent.subscribe(() => {+ const confirmModal = this.opModalService.show(ConfirmDialogModalComponent, this.injector, { options });+ confirmModal.closingEvent.subscribe((modal:ConfirmDialogModalComponent) => {if (modal.confirmed) {resolve();} else {reject();}- }));+ });});}diff --git a/frontend/src/app/shared/components/modals/editor/editor-macros.service.ts b/frontend/src/app/shared/components/modals/editor/editor-macros.service.tsindex e7a42044256..aec476eede8 100644--- a/frontend/src/app/shared/components/modals/editor/editor-macros.service.ts+++ b/frontend/src/app/shared/components/modals/editor/editor-macros.service.ts@@ -45,15 +45,12 @@ export class EditorMacrosService {*/public configureWorkPackageButton(typeName?:string, classes?:string):Promise<{ type:string, classes:string }> {return new Promise<{ type:string, classes:string }>((resolve, reject) => {- this.opModalService.show(- WpButtonMacroModalComponent,- this.injector,- { type: typeName, classes },- ).subscribe((modal) => modal.closingEvent.subscribe(() => {+ const modal = this.opModalService.show(WpButtonMacroModalComponent, this.injector, { type: typeName, classes });+ modal.closingEvent.subscribe((modal:WpButtonMacroModalComponent) => {if (modal.changed) {resolve({ type: modal.type, classes: modal.classes });}- }));+ });});}@@ -64,15 +61,12 @@ export class EditorMacrosService {public configureWikiPageInclude(page:string):Promise<string> {return new Promise<string>((resolve, _) => {const pageValue = page || '';- this.opModalService.show(- WikiIncludePageMacroModalComponent,- this.injector,- { page: pageValue },- ).subscribe((modal) => modal.closingEvent.subscribe(() => {+ const modal = this.opModalService.show(WikiIncludePageMacroModalComponent, this.injector, { page: pageValue });+ modal.closingEvent.subscribe((modal:WikiIncludePageMacroModalComponent) => {if (modal.changed) {resolve(modal.page);}- }));+ });});}@@ -82,15 +76,12 @@ export class EditorMacrosService {*/public editCodeBlock(content:string, languageClass:string):Promise<{ content:string, languageClass:string }> {return new Promise<{ content:string, languageClass:string }>((resolve, _) => {- this.opModalService.show(- CodeBlockMacroModalComponent,- this.injector,- { content, languageClass },- ).subscribe((modal) => modal.closingEvent.subscribe(() => {+ const modal = this.opModalService.show(CodeBlockMacroModalComponent, this.injector, { content, languageClass });+ modal.closingEvent.subscribe((modal:CodeBlockMacroModalComponent) => {if (modal.changed) {resolve({ languageClass: modal.languageClass, content: modal.content });}- }));+ });});}@@ -100,18 +91,15 @@ export class EditorMacrosService {*/public configureChildPages(page:string, includeParent:string):Promise<object> {return new Promise<object>((resolve, _) => {- this.opModalService.show(- ChildPagesMacroModalComponent,- this.injector,- { page, includeParent },- ).subscribe((modal) => modal.closingEvent.subscribe(() => {+ const modal = this.opModalService.show(ChildPagesMacroModalComponent, this.injector, { page, includeParent });+ modal.closingEvent.subscribe((modal:ChildPagesMacroModalComponent) => {if (modal.changed) {resolve({page: modal.page,includeParent: modal.includeParent,});}- }));+ });});}}diff --git a/frontend/src/app/shared/components/modals/export-modal/wp-table-export.modal.ts b/frontend/src/app/shared/components/modals/export-modal/wp-table-export.modal.tsindex dcbfc444e4d..aa985790bde 100644--- a/frontend/src/app/shared/components/modals/export-modal/wp-table-export.modal.ts+++ b/frontend/src/app/shared/components/modals/export-modal/wp-table-export.modal.ts@@ -35,7 +35,7 @@ export class WpTableExportModalComponent extends OpModalComponent implements OnI/* Close on outside click */public closeOnOutsideClick = true;- public $element:HTMLElement;+ public $element:JQuery;public exportOptions:{ identifier:string, label:string, url:string }[];@@ -46,8 +46,7 @@ export class WpTableExportModalComponent extends OpModalComponent implements OnIcancelButton: this.I18n.t('js.button_cancel'),};- constructor(- @Inject(OpModalLocalsToken) public locals:OpModalLocalsMap,+ constructor(@Inject(OpModalLocalsToken) public locals:OpModalLocalsMap,readonly I18n:I18nService,readonly elementRef:ElementRef,readonly querySpace:IsolatedQuerySpace,@@ -55,8 +54,7 @@ export class WpTableExportModalComponent extends OpModalComponent implements OnIreadonly httpClient:HttpClient,readonly wpTableColumns:WorkPackageViewColumnsService,readonly loadingIndicator:LoadingIndicatorService,- readonly toastService:ToastService,- ) {+ readonly toastService:ToastService) {super(locals, cdRef, elementRef);}@@ -138,7 +136,7 @@ export class WpTableExportModalComponent extends OpModalComponent implements OnIreturn url.toString();}- protected get afterFocusOn():HTMLElement {- return document.getElementById('work-packages-settings-button')!;+ protected get afterFocusOn():JQuery {+ return jQuery('#work-packages-settings-button');}}diff --git a/frontend/src/app/shared/components/modals/modal-wrapper/dynamic-content.modal.html b/frontend/src/app/shared/components/modals/modal-wrapper/dynamic-content.modal.htmlindex 1589434941d..0841ea9e823 100644--- a/frontend/src/app/shared/components/modals/modal-wrapper/dynamic-content.modal.html+++ b/frontend/src/app/shared/components/modals/modal-wrapper/dynamic-content.modal.html@@ -1,5 +1,4 @@<divclass="spot-modal dynamic-content-modal--wrapper loading-indicator--location"- #wrapperdata-indicator-name="modal"></div>diff --git a/frontend/src/app/shared/components/modals/modal-wrapper/dynamic-content.modal.ts b/frontend/src/app/shared/components/modals/modal-wrapper/dynamic-content.modal.tsindex 78b96d67f16..cdf9a4360ba 100644--- a/frontend/src/app/shared/components/modals/modal-wrapper/dynamic-content.modal.ts+++ b/frontend/src/app/shared/components/modals/modal-wrapper/dynamic-content.modal.ts@@ -28,7 +28,7 @@import {ChangeDetectionStrategy,- ChangeDetectorRef, Component, ElementRef, Inject, OnDestroy, OnInit, ViewChild,+ ChangeDetectorRef, Component, ElementRef, Inject, OnDestroy, OnInit,} from '@angular/core';import { OpModalLocalsToken } from 'core-app/shared/components/modal/modal.service';import { OpModalLocalsMap } from 'core-app/shared/components/modal/modal.types';@@ -45,14 +45,10 @@ export class DynamicContentModalComponent extends OpModalComponent implements On// the modal when removing error messages or clicking on labels e.g. in the registration modal.public closeOnOutsideClick = false;- @ViewChild('wrapper') wrapper:HTMLElement;-- constructor(- readonly elementRef:ElementRef,+ constructor(readonly elementRef:ElementRef,@Inject(OpModalLocalsToken) public locals:OpModalLocalsMap,readonly cdRef:ChangeDetectorRef,- readonly I18n:I18nService,- ) {+ readonly I18n:I18nService) {super(locals, cdRef, elementRef);}@@ -60,11 +56,13 @@ export class DynamicContentModalComponent extends OpModalComponent implements Onsuper.ngOnInit();// Append the dynamic body- this.wrapper.classList.add(this.locals.modalClassName);- this.wrapper.appendChild(this.locals.modalBody);+ this.$element+ .find('.dynamic-content-modal--wrapper')+ .addClass(this.locals.modalClassName)+ .append(this.locals.modalBody);const modal = document.querySelector('.spot-modal') as HTMLElement;- const closeButton = modal.querySelector('[dynamic-content-modal-close-button]') as HTMLButtonElement;+ const closeButton = modal.querySelector('[dynamic-content-modal-close-button]') as HTMLMetaElement;closeButton.addEventListener('click', () => this.closeMe());}diff --git a/frontend/src/app/shared/components/modals/save-modal/save-query.modal.ts b/frontend/src/app/shared/components/modals/save-modal/save-query.modal.tsindex 85bbafdae25..5475f6f87bf 100644--- a/frontend/src/app/shared/components/modals/save-modal/save-query.modal.ts+++ b/frontend/src/app/shared/components/modals/save-modal/save-query.modal.ts@@ -66,8 +66,7 @@ export class SaveQueryModalComponent extends OpModalComponent {close_popup: this.I18n.t('js.close_popup_title'),};- constructor(- readonly elementRef:ElementRef,+ constructor(readonly elementRef:ElementRef,@Inject(OpModalLocalsToken) public locals:OpModalLocalsMap,readonly I18n:I18nService,readonly states:States,@@ -75,8 +74,7 @@ export class SaveQueryModalComponent extends OpModalComponent {readonly wpListService:WorkPackagesListService,readonly halNotification:HalResourceNotificationService,readonly cdRef:ChangeDetectorRef,- readonly toastService:ToastService,- ) {+ readonly toastService:ToastService) {super(locals, cdRef, elementRef);}@@ -90,7 +88,7 @@ export class SaveQueryModalComponent extends OpModalComponent {}public get afterFocusOn() {- return document.getElementById('work-packages-settings-button')!;+ return jQuery('#work-packages-settings-button');}public saveQueryAs($event:Event):void {diff --git a/frontend/src/app/shared/components/modals/share-modal/query-sharing.modal.ts b/frontend/src/app/shared/components/modals/share-modal/query-sharing.modal.tsindex 88e0d94f498..4609d7b089b 100644--- a/frontend/src/app/shared/components/modals/share-modal/query-sharing.modal.ts+++ b/frontend/src/app/shared/components/modals/share-modal/query-sharing.modal.ts@@ -64,8 +64,7 @@ export class QuerySharingModalComponent extends OpModalComponent implements OnInclose_popup: this.I18n.t('js.close_popup_title'),};- constructor(- readonly elementRef:ElementRef,+ constructor(readonly elementRef:ElementRef,@Inject(OpModalLocalsToken) public locals:OpModalLocalsMap,readonly I18n:I18nService,readonly states:States,@@ -73,8 +72,7 @@ export class QuerySharingModalComponent extends OpModalComponent implements OnInreadonly cdRef:ChangeDetectorRef,readonly wpListService:WorkPackagesListService,readonly halNotification:HalResourceNotificationService,- readonly toastService:ToastService,- ) {+ readonly toastService:ToastService) {super(locals, cdRef, elementRef);}@@ -93,7 +91,7 @@ export class QuerySharingModalComponent extends OpModalComponent implements OnIn}public get afterFocusOn() {- return document.getElementById('work-packages-settings-button')!;+ return jQuery('#work-packages-settings-button');}public saveQuery($event:Event):void {diff --git a/frontend/src/app/shared/components/time_entries/create/create.service.ts b/frontend/src/app/shared/components/time_entries/create/create.service.tsindex d4f6544f829..26aa1774bfb 100644--- a/frontend/src/app/shared/components/time_entries/create/create.service.ts+++ b/frontend/src/app/shared/components/time_entries/create/create.service.ts@@ -38,21 +38,21 @@ export class TimeEntryCreateService {void this.createNewTimeEntry(date, wp).then((changeset) => {- this.opModalService.show(+ const modal = this.opModalService.show(TimeEntryCreateModalComponent,this.injector,{ ...options, changeset },- ).subscribe((modal) => {- modal- .closingEvent- .pipe(take(1))- .subscribe(() => {- if (modal.createdEntry) {- resolve({ entry: modal.createdEntry, action: 'create' });- } else {- reject();- }- });+ );++ modal+ .closingEvent+ .pipe(take(1))+ .subscribe(() => {+ if (modal.createdEntry) {+ resolve({ entry: modal.createdEntry, action: 'create' });+ } else {+ reject();+ }});});});diff --git a/frontend/src/app/shared/components/time_entries/edit/edit.service.ts b/frontend/src/app/shared/components/time_entries/edit/edit.service.tsindex cdc0417a4e2..90b7f8c0f6e 100644--- a/frontend/src/app/shared/components/time_entries/edit/edit.service.ts+++ b/frontend/src/app/shared/components/time_entries/edit/edit.service.ts@@ -31,25 +31,29 @@ export class TimeEntryEditService {return new Promise<{ entry:TimeEntryResource, action:'update'|'destroy' }>((resolve, reject) => {void this.createChangeset(entry)- .then((changeset) => this.opModalService.show(- TimeEntryEditModalComponent,- this.injector,- { ...options, changeset },- ).subscribe((modal) => modal- .closingEvent- .pipe(take(1))- .subscribe(() => {- if (modal.destroyedEntry) {- // eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access- void modal.destroyedEntry.delete().then(() => {- resolve({ entry: modal.destroyedEntry, action: 'destroy' });- });- } else if (modal.modifiedEntry) {- resolve({ entry: modal.modifiedEntry, action: 'update' });- } else {- reject();- }- })));+ .then((changeset) => {+ const modal = this.opModalService.show(+ TimeEntryEditModalComponent,+ this.injector,+ { ...options, changeset },+ );++ modal+ .closingEvent+ .pipe(take(1))+ .subscribe(() => {+ if (modal.destroyedEntry) {+ // eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access+ modal.destroyedEntry.delete().then(() => {+ resolve({ entry: modal.destroyedEntry, action: 'destroy' });+ });+ } else if (modal.modifiedEntry) {+ resolve({ entry: modal.modifiedEntry, action: 'update' });+ } else {+ reject();+ }+ });+ });});}diff --git a/frontend/src/app/shared/components/work-package-graphs/configuration-modal/wp-graph-configuration.modal.ts b/frontend/src/app/shared/components/work-package-graphs/configuration-modal/wp-graph-configuration.modal.tsindex 30af5cc521a..0ee311944ee 100644--- a/frontend/src/app/shared/components/work-package-graphs/configuration-modal/wp-graph-configuration.modal.ts+++ b/frontend/src/app/shared/components/work-package-graphs/configuration-modal/wp-graph-configuration.modal.ts@@ -43,7 +43,7 @@ export class WpGraphConfigurationModalComponent extends OpModalComponent impleme/* Close on outside click */public closeOnOutsideClick = false;- public $element:HTMLElement;+ public $element:JQuery;public text = {title: this.I18n.t('js.chart.modal_title'),@@ -79,7 +79,7 @@ export class WpGraphConfigurationModalComponent extends OpModalComponent impleme}ngOnInit():void {- this.$element = this.elementRef.nativeElement as HTMLElement;+ this.$element = jQuery(this.elementRef.nativeElement);this.loadingIndicator.indicator('modal').promise = this.graphConfiguration.loadForms().then(() => {@@ -134,7 +134,7 @@ export class WpGraphConfigurationModalComponent extends OpModalComponent implemereturn true;}- protected get afterFocusOn():HTMLElement {+ protected get afterFocusOn():JQuery {return this.$element;}}diff --git a/frontend/src/app/spot/components/drop-modal/drop-modal.component.html b/frontend/src/app/spot/components/drop-modal/drop-modal.component.htmlindex 8bd238a9cae..b9d622d49a2 100644--- a/frontend/src/app/spot/components/drop-modal/drop-modal.component.html+++ b/frontend/src/app/spot/components/drop-modal/drop-modal.component.html@@ -1,12 +1,9 @@<ng-content select="[slot=trigger]"></ng-content><div- *ngIf="open"[ngClass]="['spot-drop-modal--body', 'spot-container', alignmentClass]"-(click)="onBodyClick($event)"-cdkTrapFocus- tabindex="0"+ *ngIf="open"><ng-content select="[slot=body]"></ng-content>diff --git a/frontend/src/app/spot/spot.module.ts b/frontend/src/app/spot/spot.module.tsindex 8ab5413d3db..b7ec798807e 100644--- a/frontend/src/app/spot/spot.module.ts+++ b/frontend/src/app/spot/spot.module.ts@@ -4,7 +4,6 @@ import {ReactiveFormsModule,} from '@angular/forms';import { CommonModule } from '@angular/common';-import { A11yModule } from '@angular/cdk/a11y';import { I18nService } from 'core-app/core/i18n/i18n.service';import { SpotCheckboxComponent } from './components/checkbox/checkbox.component';@@ -24,7 +23,6 @@ import { SpotSelectorFieldComponent } from './components/selector-field/selectorFormsModule,ReactiveFormsModule,CommonModule,- A11yModule,],providers: [diff --git a/frontend/src/app/spot/styles/sass/components/modal-overlay.sass b/frontend/src/app/spot/styles/sass/components/modal-overlay.sassindex e8d8010d134..aff8382a2e0 100644--- a/frontend/src/app/spot/styles/sass/components/modal-overlay.sass+++ b/frontend/src/app/spot/styles/sass/components/modal-overlay.sass@@ -26,13 +26,3 @@right: unsetbottom: unsettop: initial-- &--close-button- display: block- margin: 1rem-- @media (min-width: 680px)- display: none-- @media (max-height: 480px)- align-self: end