dropdown-menu component inconsistent with nav component (missing attributes)

Created on 5 January 2025, 16 days ago

Problem/Motivation

Top-level menu items are rendered by the nav component using the twig link() function, which fully supports attributes, not just the href and class. However, when a menu is nested, the dropdown-menu component directly generates the link, rather than using the twig link() function.

Steps to reproduce

Generate a menu bar with a nested menu item. Provide additional attributes (other than class) in the menu definition. For example:

cocktail.login:
  route_name: user.login
  title: 'Log in'
  weight: 0
  description: 'Log in to your account.'
  options:
    attributes:
      class:
        - 'use-ajax'
        - 'login-popup-form'
      data-dialog-type: bootstrap4_modal
      data-dialog-options: '{"dialogClasses":"modal-dialog-centered modal-sm"}'
    query:
      destination: '<front>'
  parent: account_menu
πŸ› Bug report
Status

Active

Version

6.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States danchadwick Boston

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

Comments & Activities

Production build 0.71.5 2024