Mobile menu JavaScript breaks when translated.

Created on 29 June 2023, 12 months ago
Updated 22 March 2024, 3 months ago

Problem/Motivation

When translating a menu `tb_megamenu/templates/tb-megamenu.html.twig` throws an error `Uncaught SyntaxError: Unexpected token 'if'` on line 34.

The hideMobile variale is returning '' or nothing. Then a variable is assigned to the block config that is returning nothing so the assignment results in `var hideMobile = `

Steps to reproduce

Have a menu with mobile enabled. Translate it. View page in desktop mode as translated page.

Proposed resolution

Change line 32 to use twig's ternary `?: 0` have graceful fallback to int of 0 instead of empty.

Remaining tasks

Create patch

πŸ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States cpierce42

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024