Skip to content

[FIX] web_responsive: target env.isSmall in apps_menu xpath#3552

Open
Adrian016 wants to merge 1 commit into
OCA:18.0from
Adrian016:18.0-fix-web_responsive-apps_menu-isSmall
Open

[FIX] web_responsive: target env.isSmall in apps_menu xpath#3552
Adrian016 wants to merge 1 commit into
OCA:18.0from
Adrian016:18.0-fix-web_responsive-apps_menu-isSmall

Conversation

@Adrian016
Copy link
Copy Markdown

Symptom

web_responsive installs cleanly on Odoo 18 CE, but the responsive apps-menu behaviour (sidebar / dropdown swap on small screens) never takes effect — the standard web.NavBar.AppsMenu template is rendered unchanged.

Root cause

web_responsive/static/src/components/apps_menu/apps_menu.xml extends web.NavBar.AppsMenu with two xpath expressions targeting t-if='this.ui.isSmall'. The base Odoo 18 template uses t-if='env.isSmall' (addons/web/static/src/webclient/navbar/navbar.xml). The xpath targets therefore match nothing and both customisations silently no-op.

This is a residue from the Odoo 17 → 18 port: Odoo 17 exposed the small-screen flag via useService(\"ui\").isSmall; Odoo 18 moved it onto the env as env.isSmall. Other web_responsive files were updated for the new pattern — this one was missed.

Fix

Two-line change: swap the xpath target and the t-if expression to use env.isSmall, matching the base template.

```diff

  •    <xpath expr=\"//t[@t-if='this.ui.isSmall']\" position=\"attributes\">
    
  •    <xpath expr=\"//t[@t-if='env.isSmall']\" position=\"attributes\">
           <attribute name=\"t-if\">false</attribute>
       </xpath>
       <!-- The kanban dropdown is replaced with the odoo default one
       as the default one took physical place in the DOM -->
       <xpath expr=\"//Dropdown\" position=\"replace\">
    
  •        <t t-if=\"this.ui.isSmall\">
    
  •        <t t-if=\"env.isSmall\">
               <t t-call=\"web.NavBar.AppsMenu.Sidebar\" />
           </t>
    

```

How to verify

  1. Apply the patch on top of 18.0
  2. Install / upgrade web_responsive on a fresh Odoo 18 CE DB
  3. Resize the browser to a small viewport (< 768px) or open the web client in a mobile emulator
  4. Click the apps menu — the responsive sidebar swap should now render. Without the patch the standard navbar dropdown shows instead.

The xpath inheritance in web_responsive's apps_menu.xml is targeting
`t-if='this.ui.isSmall'`, but the base Odoo 18 web.NavBar.AppsMenu
template uses `t-if='env.isSmall'` (see addons/web/static/src/webclient/
navbar/navbar.xml). The xpath therefore matches no element and the
inheritance silently no-ops — the responsive apps menu falls back to
the standard navbar behaviour and the customisations in this file
are never applied.

This is a residue from the Odoo 17 -> 18 port: Odoo 17 exposed the
small-screen flag via `useService("ui").isSmall`, while Odoo 18 moved
it onto the env as `env.isSmall`. Other web_responsive files were
updated; this one was missed.

Two-line change: swap the xpath target and the t-if expression to use
`env.isSmall`, matching the base template.

Symptom seen by users: web_responsive installed and shown as enabled,
but the responsive apps menu (and its sidebar/dropdown swap) does not
take effect on small screens.

Signed-off-by: Adrian <[email protected]>
@OCA-git-bot
Copy link
Copy Markdown
Contributor

Hi @SplashS, @Tardo,
some modules you are maintaining are being modified, check this out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants