Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FW][FIX] website: make anchor links work in offcanvas mobile menu #146897

Conversation

fw-bot
Copy link
Contributor

@fw-bot fw-bot commented Dec 19, 2023

A anchor menu in the mobile offcanvas related to an element in the
current page doesn't work in offcanvas.

This is because the menu anchor navigation is hooked to use our own
scrolling behavior instead of the browser one.

Doing so, we preventDefault, which prevent the offcanvas menu to close
itself when clicking on a anchor menu.

This commit simply manually close the offcanvas and once the closing
animation is complete, starts our own smooth scrolling.

Another possibility would have been to just close manually the offcanvas
without a preventDefault and without a call to our custom scrolling
method.
Doing so, the browser would naturally scroll to the element while we
close the offcanvas but it would be less elegant as you wouldn't see the
scrolling animation.

Note that the offcanvas was introduced with commit 1.

opw-3604963

Forward-Port-Of: #146132

A anchor menu in the mobile collapse related to an element in the
current page doesn't work correctly:
- The collapse-menu doesn't close
- If the menu is large enough, on mobile, you actually don't even see
  the page scrolling behind it so it looks like the click did nothing.

This is probably because of the switch from BS4 to BS5.
In later version, it's even worse, as we are using bootstrap Offcanvas
instead of collapse, creating another bug:
- The page doesn't scroll at all

This will be fixed in the forward port.

This commit simply manually closes the collapse before starting  our own
smooth scrolling.
It also targets the desktop offcanvas menu (when hamburger layout is
selected).

opw-3604963

X-original-commit: db881e6
@robodoo
Copy link
Contributor

robodoo commented Dec 19, 2023

Pull request status dashboard.

@fw-bot
Copy link
Contributor Author

fw-bot commented Dec 19, 2023

This PR targets saas-16.3 and is part of the forward-port chain. Further PRs will be created up to master.

More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port

@robodoo robodoo added the forwardport This PR was created by @fw-bot label Dec 19, 2023
@C3POdoo C3POdoo added the OE the report is linked to a support ticket (opw-...) label Dec 19, 2023
robodoo pushed a commit that referenced this pull request Dec 20, 2023
A anchor menu in the mobile collapse related to an element in the
current page doesn't work correctly:
- The collapse-menu doesn't close
- If the menu is large enough, on mobile, you actually don't even see
  the page scrolling behind it so it looks like the click did nothing.

This is probably because of the switch from BS4 to BS5.
In later version, it's even worse, as we are using bootstrap Offcanvas
instead of collapse, creating another bug:
- The page doesn't scroll at all

This will be fixed in the forward port.

This commit simply manually closes the collapse before starting  our own
smooth scrolling.
It also targets the desktop offcanvas menu (when hamburger layout is
selected).

opw-3604963

closes #146897

X-original-commit: db881e6
Signed-off-by: Quentin Smetz (qsm) <[email protected]>
Signed-off-by: Romain Derie (rde) <[email protected]>
@robodoo robodoo closed this Dec 20, 2023
@fw-bot fw-bot deleted the saas-16.3-17.0-fix-offcanvas-mobile-anchor-rde-lCBq-fw branch January 3, 2024 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
forwardport This PR was created by @fw-bot OE the report is linked to a support ticket (opw-...)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants