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

Remove special mobile scrolling behavior that we introduced to collapse the adress bar on iOS Safari. It somehow conflicts with the positioning of the ActionMenu

Henriette Dargec1e02aebc13d
diff --git a/frontend/src/app/core/setup/globals/global-listeners/top-menu-scroll.ts b/frontend/src/app/core/setup/globals/global-listeners/top-menu-scroll.ts
index ad9435d36a7..842c1d9ff1e 100644
--- a/frontend/src/app/core/setup/globals/global-listeners/top-menu-scroll.ts
+++ b/frontend/src/app/core/setup/globals/global-listeners/top-menu-scroll.ts
@@ -31,22 +31,26 @@ export function scrollHeaderOnMobile() {
const headerHeight = 55;
let prevScrollPos = window.scrollY;
- window.addEventListener('scroll', () => {
- // Condition needed for safari browser to avoid negative positions
- const currentScrollPos = window.scrollY < 0 ? 0 : window.scrollY;
- // Only if sidebar is not opened or search bar is opened
- if (!(jQuery('#main').hasClass('hidden-navigation'))
+ const scrollableElement = document.getElementById('content-body');
+
+ if (scrollableElement) {
+ scrollableElement.addEventListener('scroll', () => {
+ // Condition needed for safari browser to avoid negative positions
+ const currentScrollPos = scrollableElement.scrollTop < 0 ? 0 : scrollableElement.scrollTop;
+ // Only if sidebar is not opened or search bar is opened
+ if (!(jQuery('#main').hasClass('hidden-navigation'))
|| jQuery('.op-app-header').hasClass('op-app-header_search-open')
|| Math.abs(currentScrollPos - prevScrollPos) <= headerHeight) { // to avoid flickering at the end of the page
- return;
- }
+ return;
+ }
- if (prevScrollPos !== undefined && currentScrollPos !== undefined && (prevScrollPos > currentScrollPos)) {
- // Slide top menu in or out of viewport and change viewport height
- jQuery('#wrapper').removeClass('_header-scrolled');
- } else {
- jQuery('#wrapper').addClass('_header-scrolled');
- }
- prevScrollPos = currentScrollPos;
- });
+ if (prevScrollPos !== undefined && currentScrollPos !== undefined && (prevScrollPos > currentScrollPos)) {
+ // Slide top menu in or out of viewport and change viewport height
+ jQuery('#wrapper').removeClass('_header-scrolled');
+ } else {
+ jQuery('#wrapper').addClass('_header-scrolled');
+ }
+ prevScrollPos = currentScrollPos;
+ });
+ }
}
diff --git a/frontend/src/global_styles/layout/_base_mobile.sass b/frontend/src/global_styles/layout/_base_mobile.sass
index c99c1357f2d..2e17194bb34 100644
--- a/frontend/src/global_styles/layout/_base_mobile.sass
+++ b/frontend/src/global_styles/layout/_base_mobile.sass
@@ -32,34 +32,15 @@
-webkit-overflow-scrolling: touch
height: 100%
- // ------------------- BEGIN CHANGED SCROLL BEHAVIOR
- // Change scroll behavior on mobile:
- // Let the window be the one who scrolls.
- // Thus we make sure, that mobile browsers (like iOS Safari) hide their toolbars on scroll.
- html
- overflow: auto
- body,
- #main
- overflow: visible
-
- #wrapper,
- #content-wrapper,
- #content-body,
- #content-bodyRight
- overflow: hidden
-
#main
margin-top: var(--header-height)
- ._header-scrolled &
+ ._header-scrolled
+ #main
margin-top: 0
-
- #content-wrapper
- height: 100%
- // Take care that the wrapper has the available screen height at the least
- // Check for example notification center on mobile before changing that
- min-height: calc(100vh - var(--header-height))
- // ------------------- END CHANGED SCROLL BEHAVIOR
+ #main,
+ #content-wrapper
+ height: 100dvh
#content-body,
#content-header
diff --git a/frontend/src/global_styles/layout/_main_menu_mobile.sass b/frontend/src/global_styles/layout/_main_menu_mobile.sass
index 17a6ba029e3..aa3e684b008 100644
--- a/frontend/src/global_styles/layout/_main_menu_mobile.sass
+++ b/frontend/src/global_styles/layout/_main_menu_mobile.sass
@@ -61,12 +61,9 @@
background: #fff
transition: background .3s
- #main:not(.nosidebar)
- .content-overlay
- display: block
-
#wrapper:not(.hidden-navigation)
.content-overlay
+ display: block
position: fixed
height: 100%
background: #000