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

[51836] Widget options popup scrolls up with the page (#15016)

Behrokh Satarnejad959ed274e3f4
diff --git a/frontend/src/app/shared/components/op-context-menu/op-context-menu.service.ts b/frontend/src/app/shared/components/op-context-menu/op-context-menu.service.ts
index b13944a0f9b..316fdfe8c6e 100644
--- a/frontend/src/app/shared/components/op-context-menu/op-context-menu.service.ts
+++ b/frontend/src/app/shared/components/op-context-menu/op-context-menu.service.ts
@@ -61,13 +61,22 @@ export class OPContextMenuService {
return true;
});
- // Listen to any click and close the active context menu
const that = this;
- document.getElementById('wrapper')!.addEventListener('click', (evt:Event) => {
- if (that.active && !that.portalHostElement.contains(evt.target as Element)) {
- that.close();
- }
- }, true);
+ const wrapper = document.getElementById('wrapper');
+ if (wrapper) {
+ // Listen to any click and close the active context menu
+ wrapper.addEventListener('click', (evt:Event) => {
+ if (that.active && !that.portalHostElement.contains(evt.target as Element)) {
+ that.close();
+ }
+ }, true);
+ // Listen if it scrolles then close the active context menu
+ wrapper.addEventListener('scroll', (evt:Event) => {
+ if (that.active && !that.portalHostElement.contains(evt.target as Element)) {
+ that.close();
+ }
+ }, true);
+ }
}
/**