Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 294895

Link render element overwrites CSS class

$
0
0

Problem/Motivation

The Link render element supports supplying attributes both in $element['#attributes'] and $element['#options']['attributes']. These are combined with an array + operator, which does not combine classes when they are present in both array elements.

Steps to reproduce

The Twig extension add_class() sets the class in the #attributes. For a link, there may already be a class in the #options. This happens in radix v6 for local tasks and is exhibited when viewing a page which is a secondary local task. The primary local task has a class of "is-active" and radix adds classes "nav-link" and "active", which fails.

1. Install Radix v6.
2. Create a page with primary and secondary local tasks.
3. Visit the page with the secondary local task.
4. Notice that the primary task tab is display incorrectly and contains only the "is-active" class.

Obviously there are much simpler ways to reproduce this but this is the one I know of without creating a custom module to demonstrate it.

Proposed resolution

Merge the classes in this situation.


Viewing all articles
Browse latest Browse all 294895

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>