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
Merge branch 'feature/42358-standardise-date-pickers-drop-modal-portal' into feature/42358-standardise-date-pickers-2
Benjamin Bädorf59e6ddec0c2a
diff --cc frontend/src/app/core/setup/global-dynamic-components.const.tsindex e710cd8a328,75135990a86..687e88bc2e8--- a/frontend/src/app/core/setup/global-dynamic-components.const.ts+++ b/frontend/src/app/core/setup/global-dynamic-components.const.ts@@@ -267,8 -269,6 +268,9 @@@ export const globalDynamicComponents:Op{ selector: opInAppNotificationBellSelector, cls: InAppNotificationBellComponent },{ selector: ianMenuSelector, cls: IanMenuComponent },{ selector: opModalOverlaySelector, cls: OpModalOverlayComponent },+ // It is important to initialize the remoteFieldUpdaterSelector after the opSingleDatePickerSelector,+ // because we need to access the input field of the opSingleDatePickerSelector inside the remoteFieldUpdaterSelector{ selector: opSingleDatePickerSelector, cls: OpSingleDatePickerComponent },+ { selector: remoteFieldUpdaterSelector, cls: RemoteFieldUpdaterComponent },+ { selector: spotDropModalPortalComponentSelector, cls: SpotDropModalPortalComponent },];diff --cc frontend/src/app/spot/components/drop-modal/drop-modal.component.tsindex 32461a7b39f,edd0b3682e3..d9970fa3abd--- a/frontend/src/app/spot/components/drop-modal/drop-modal.component.ts+++ b/frontend/src/app/spot/components/drop-modal/drop-modal.component.ts@@@ -67,44 -71,10 +71,44 @@@ export class SpotDropModalComponent impreturn;}++<<<<<<< HEAD+ this._open = !!value;++ if (this._open) {+ /* We have to set these listeners next tick, because they're so far up the tree.+ * If the open value was set because of a click listener in the trigger slot,+ * that event would reach the event listener added here and close the modal right away.+ */+ setTimeout(() => {+ document.body.addEventListener('click', this.closeEventListener);+ document.body.addEventListener('keydown', this.escapeListener);+ window.addEventListener('resize', this.appHeightListener);+ window.addEventListener('orientationchange', this.appHeightListener);+ this.appHeightListener();++ if (this.allowRepositioning) {+ this.recalculateAlignment();+ }++ // If we already have focus within the modal, don't move it+ if ((this.elementRef.nativeElement as HTMLElement).contains(document.activeElement)) {+ return;+ }++ const focusCatcherContainer = document.querySelectorAll("[data-modal-focus-catcher-container='true']")[0];+ if (focusCatcherContainer) {+ (findAllFocusableElementsWithin(focusCatcherContainer as HTMLElement)[0]).focus();+ } else {+ // Index 1 because the element at index 0 is the trigger button to open the modal+ (findAllFocusableElementsWithin(this.elementRef.nativeElement as HTMLElement)[1]).focus();+ }+ });++=======+ if (!!value) {+ this.open();++>>>>>>> feature/42358-standardise-date-pickers-drop-modal-portal} else {- document.body.removeEventListener('click', this.closeEventListener);- document.body.removeEventListener('keydown', this.escapeListener);- window.removeEventListener('resize', this.appHeightListener);- window.removeEventListener('orientationchange', this.appHeightListener);-- this.closed.emit();+ this.close();}}@@@ -162,36 -217,25 +251,27 @@@const alignments = Object.values(SpotDropAlignmentOption) as SpotDropAlignmentOption[];const index = alignments.indexOf(this.alignment);+ const originalAlignmentClass = this.alignmentClass;+ const modalBodyEl = this.modalBody.nativeElement as HTMLElement;- const possibleAlignments = [+ const possibleAlignment = [...alignments.splice(index),...alignments.splice(0, index),- ].filter((alignment:SpotDropAlignmentOption) => {- modalBodyEl.classList.remove(this.alignmentClass);- this.calculatedAlignment = alignment;- modalBodyEl.classList.add(this.alignmentClass);- const rect = modalBodyEl.getBoundingClientRect();-- const spaceOnLeft = parentRect.left <= rect.left;- const spaceOnRight = parentRect.right >= rect.right;- const spaceOnTop = parentRect.top <= rect.top;- const spaceOnBottom = parentRect.bottom >= rect.bottom;- return spaceOnLeft && spaceOnRight && spaceOnTop && spaceOnBottom;- });-- /**- * We need to remove any residual classes left on the nativeElement after- * calculating the possibleAlignments. The final calculated alignment- * is applied via the `alignmentClass` function anyway.- */-- modalBodyEl.classList.remove(this.alignmentClass);- modalBodyEl.classList.add(originalAlignmentClass);+ ].find((alignment:SpotDropAlignmentOption) => {+ modalBody.classList.remove(this.alignmentClass);+ this.calculatedAlignment = alignment;+ modalBody.classList.add(this.alignmentClass);+ const rect = modalBody.getBoundingClientRect();++ const spaceOnLeft = rect.left >= 0;+ const spaceOnRight = rect.right <= window.innerWidth;+ const spaceOnTop = rect.top >= 0;+ const spaceOnBottom = rect.bottom <= window.innerHeight;+ return spaceOnLeft && spaceOnRight && spaceOnTop && spaceOnBottom;+ });- if (possibleAlignments.length) {- this.calculatedAlignment = possibleAlignments[0];+ if (possibleAlignment) {+ this.calculatedAlignment = possibleAlignment;} else {this.calculatedAlignment = this.alignment;}