Problem/Motivation
For anonymous users, links to the front page* get the is-active
class on all pages given that there is a legitimately active link** that comes after them somewhere in the HTML response.
* More precisely: links that have the data-drupal-link-system-path
attribute set to <front>
. (Links to the front page can also have the actual front page path (e.g. node
) in the attribute in which case this bug does not surface.)
** In fact it is sufficient if the data-drupal-link-system-path
attribute matches the current path, even if, for example, the language of the query parameters of the link result in the link not being marked active in the end.
Steps to reproduce
- Enable the Compose tips link on
/admin/structure/menu/manage/tools
- Make sure you are logged out
- Go to
/filter/tips
- See that the Home link in the primary menu gets marked as active, where it should not.
Proposed resolution
The bug is caused by a slight logic error in ActiveLinkResponseFilter::setLinkActiveClass()
. A check whether $is_front
is TRUE
is missing in one spot.
User interface changes
None.
API changes
None.
Data model changes
None.
Comment | File | Size | Author |
---|---|---|---|
#5 | 2560987-5-active-link.patch | 3.46 KB | tstoeckler |
#2 | 2560987-4-active-link--tests-only.patch | 1.67 KB | tstoeckler |
active-link.png | 31.47 KB | tstoeckler |
Comments
Comment #2
tstoecklerHere we go.
Comment #4
dawehnerIt would be nice to document that a bit.
named tests would be nice
Comment #5
tstoecklerYour wish is my command.... or something like that.
Comment #6
dawehnerIt was a small bug fix, but a big fix for the long term maintainability of this function.
Comment #7
alexpottNice find and simple fix. Committed a53ec3d and pushed to 8.0.x. Thanks!