Views do not add the "active" class anymore

Created on 18 January 2016, almost 9 years ago
Updated 20 September 2024, 2 months ago

Problem/Motivation

In Drupal 7, thanks to the implementation of l(), an "active" class was automatically added when generating node listing with views, and when the linked entity's URI was the same as the one listed.

With #1979468: ".active" from linkGenerator(), l() and theme_links() forces an upper limit of per-page caching for all content containing links , this is not the case any more and it's been reported to not be not easily alterable.

Proposed resolution

Re add the feature as optional, via means of adding a new checkbox form field to control whether or not the active class on links will be enabled. Adding of the actual CSS class is performed via JS.

Remaining tasks

User interface changes

New Set the active class on links checkbox on views field options. Description: If checked, if the fields link to the current page, an "is-active" class will be added on active links.

API changes

New set_active_class boolean on views.row.schema

Data model changes

N/A

Release notes snippet

Views can now optionally add the "active" css class.

Original description

In Drupal 7, thanks to the implementation of l(), an "active" class was automatically added when generating node listing with views, and when the linked entity's URI was the same as the one listed.

With #1979468: ".active" from linkGenerator(), l() and theme_links() forces an upper limit of per-page caching for all content containing links , this is not the case anymore and it seem's not easily alterable (I can't my way through).

Is there a way to change this behaviour. Are we missing something in core to let us alter that ?

📌 Task
Status

Needs work

Version

11.0 🔥

Component
Views 

Last updated about 2 hours ago

Created by

🇫🇷France Haza

Live updates comments and jobs are added and updated live.
  • Needs change record

    A change record needs to be drafted before an issue is committed. Note: Change records used to be called change notifications.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024