2d33dc64e9ef0dd1750b83ccad7762bc621a111a
Offcanvas instead of Collapse in header
With the headers redesign in PR [1], the "collapse menus" (e.g. in the "Hamburger menu" and the mobile menu) are now `Offcanvas` elements instead of `Collapse` elements (see `data-bs-toggle="offcanvas"` in the headers XML templates). As such, when they are toggled, it is now `bs.offcanvas` events that are fired, instead of `bs.collapse`. However, the code using these elements and handling these events has not been adapted and is therefore never executed, which causes some issues. 1) First issue: - In edit mode, drop enough snippets to have a scroll bar. - Toggle the mobile preview and open the menu or resize the screen so it is smaller than the `SM` screen breakpoint. - With the menu still open, go back to the desktop view or resize it up beyond the `SM` breakpoint. => There is no scrollbar anymore so we cannot scroll. This happens because the selectors and event listeners managing the collapse menus and the scroll do not target the right elements/events. - On toggle, the `overflow-hidden` class should be added on the body to prevent the scroll. - On hide, this class should be removed to re-allow scrolling. => Here the scroll is prevented by chance thanks to commit [2] but it is not the right flow. - On resize, when the screen becomes bigger than `SM`, the collapse menu should be closed and the `overflow-hidden` class removed from the body (see the `_updateHeaderOnResize` function). => Not happening because the collapse menu selector is not the right one and commit [2] does not take the resizing into account. 2) Second issue: - Change the menu to "Hamburger menu". - Set the background to a dark color (so that the text is white). - Set the "Header Position" option to "Over The Content". - Open the menu. => The menu is still considered as transparent so the text is dark on a dark background, making it difficult to read. This issue was originally fixed by commit [3], by adding the `o_top_menu _collapse_shown` class when the menu is opened. It happens again because since the event is not the right one anymore, the class is never added. This commit adapts the menus public widgets code in order to consider these `Offcanvas` elements/events and restore the needed behaviors. Note that the `NavbarDropdown` public widget (added in commit [4]) is now useless. Indeed, it was added in order to prevent the dropdowns to be hidden when opened inside a burger menu, but this issue does not happen anymore when following the steps. It has already been removed in master by commit [5]. The same goes for the `TopMenuCollapse` public widget, which was added in commit [6] to avoid having a scrollbar when opening a sub-menu after resizing up the screen with the mobile menu open. It is not even started because its selector is not valid anymore (the `top_menu_collapse` id only exists in the "Hamburger menu", where the issue cannot happen), and the issue is not there anymore when following the steps, which makes the widget useless. It will be removed in master. [1]: https://github.com/odoo/odoo/pull/119650 [2]: https://github.com/odoo/odoo/commit/f6d9f80e6e8458bdcf75fca9ff3b7e7e54d2a6ba [3]: https://github.com/odoo/odoo/commit/e10913daf7025accb3b93808ae12ce4a50db1510 [4]: https://github.com/odoo/odoo/commit/ce9b350403ff7c1004b50b39588891ee652e0a3a [5]: https://github.com/odoo/odoo/commit/39b79832a0cd3e191077a11a485de78365928feb [6]: https://github.com/odoo/odoo/commit/b7a4538c51aacca666920bdd9496ee575ab12e7a task-3609531 Part-of: odoo/odoo#146492
…
…
…
Odoo
Odoo is a suite of web based open source business apps.
The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Warehouse Management, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, ...
Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.
Getting started with Odoo
For a standard installation please follow the Setup instructions from the documentation.
To learn the software, we recommend the Odoo eLearning, or Scale-up, the business game. Developers can start with the developer tutorials
Languages
Python
49.6%
JavaScript
47.8%
SCSS
2%
CSS
0.3%
HTML
0.2%