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

Comments

danchadwick created an issue. See original summary.

danchadwick’s picture

Here's a patch to harmonize dropdown-menu with nav with regard to link().

danchadwick’s picture

Status: Active » Needs review

  • danchadwick committed c683ccf7 on 6.0.x
    Issue #3497506 by danchadwick: dropdown-menu component inconsistent with...
danchadwick’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.