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

Don't close modal on mouseup on overlay

Oliver Günther5ca0770c1a8d
diff --git a/frontend/src/app/shared/components/modal/modal-overlay.component.html b/frontend/src/app/shared/components/modal/modal-overlay.component.html
index 384aad38211..3d9411c16dd 100644
--- a/frontend/src/app/shared/components/modal/modal-overlay.component.html
+++ b/frontend/src/app/shared/components/modal/modal-overlay.component.html
@@ -6,7 +6,7 @@
tabindex="0"
cdkFocusInitial
cdkTrapFocus
- (click)="close($event, false)"
+ (mousedown)="close($event, false)"
>
<button
type="button"
diff --git a/spec/features/onboarding/onboarding_tour_spec.rb b/spec/features/onboarding/onboarding_tour_spec.rb
index a651cd08361..2a7104547ff 100644
--- a/spec/features/onboarding/onboarding_tour_spec.rb
+++ b/spec/features/onboarding/onboarding_tour_spec.rb
@@ -96,8 +96,9 @@ describe 'onboarding tour for new users', js: true do
visit home_path first_time_user: true
expect(page).to have_text 'Please select your language'
- # Cancel language selection
- page.find('.spot-modal-overlay').click(x: -400, y: 1)
+ # Selenium's click doesn't properly fire a mousedown event, so we trigger both explicitly
+ page.execute_script("document.querySelector('.spot-modal-overlay').dispatchEvent(new Event('mousedown'));")
+ page.execute_script("document.querySelector('.spot-modal-overlay').dispatchEvent(new Event('click'));")
# The tutorial appears
expect(page).to have_text sanitize_string(I18n.t('js.onboarding.steps.welcome')), normalize_ws: true