Skip to content

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

[30928] Fix clicking on WP links since hover card visible

Oliver Günther3ae39f8bb4f2
diff --git a/frontend/src/app/components/op-modals/op-modal.component.ts b/frontend/src/app/components/op-modals/op-modal.component.ts
index f57994fd3be..9e7375c29a0 100644
--- a/frontend/src/app/components/op-modals/op-modal.component.ts
+++ b/frontend/src/app/components/op-modals/op-modal.component.ts
@@ -46,7 +46,12 @@ export abstract class OpModalComponent implements OnInit, OnDestroy {
}
public closeMe(evt?:JQuery.TriggeredEvent) {
- this.service.close(evt);
+ this.service.close();
+
+ if (evt) {
+ evt.stopPropagation();
+ evt.preventDefault();
+ }
}
public onOpen(modalElement:JQuery) {
diff --git a/frontend/src/app/components/op-modals/op-modal.service.ts b/frontend/src/app/components/op-modals/op-modal.service.ts
index d72337a8730..a7552f0c5f5 100644
--- a/frontend/src/app/components/op-modals/op-modal.service.ts
+++ b/frontend/src/app/components/op-modals/op-modal.service.ts
@@ -51,7 +51,7 @@ export class OpModalService {
!this.opening &&
this.active.closeOnOutsideClick &&
!this.portalHostElement.contains(evt.target as Element)) {
- this.close(evt);
+ this.close();
}
});
@@ -107,18 +107,13 @@ export class OpModalService {
/**
* Closes currently open modal window
*/
- public close(evt?:JQuery.TriggeredEvent) {
+ public close() {
// Detach any component currently in the portal
if (this.active && this.active.onClose()) {
this.active.closingEvent.emit(this.active);
this.bodyPortalHost.detach();
this.portalHostElement.style.display = 'none';
this.active = null;
-
- if (evt) {
- evt.preventDefault();
- evt.stopPropagation();
- }
}
}
diff --git a/spec/features/work_packages/details/markdown/activity_comments_spec.rb b/spec/features/work_packages/details/markdown/activity_comments_spec.rb
index 31dc1a5b342..7ecd4ce41fc 100644
--- a/spec/features/work_packages/details/markdown/activity_comments_spec.rb
+++ b/spec/features/work_packages/details/markdown/activity_comments_spec.rb
@@ -93,9 +93,17 @@ describe 'activity comments', js: true, with_mail: false do
describe 'autocomplete' do
describe 'work packages' do
let!(:wp2) { FactoryBot.create(:work_package, project: project, subject: 'AutoFoo') }
- it 'autocompletes the other work package' do
+
+ it 'can move to the work package by click (Regression #30928)' do
comment_field.input_element.send_keys("##{wp2.id}")
expect(page).to have_selector('.mention-list-item', text: wp2.to_s.strip)
+
+ comment_field.submit_by_click
+ page.find('#activity-2 a.issue', text: wp2.id).click
+
+ other_wp_page = ::Pages::FullWorkPackage.new wp2
+ other_wp_page.ensure_page_loaded
+ other_wp_page.edit_field(:subject).expect_text 'AutoFoo'
end
end