- 🇦🇺Australia mstrelan
Is this still an issue with modern browsers and Drupal 11? If so, let's get some clear steps to reproduce.
ActiveLinkResponseFilter + BigPipe + Browser conditions (currently Chrome) break 'is-active' class addition in ActiveLinkResponseFilter.php which was hard to find and seemed very strange, because it's server-side!
My current result / recommendation: Can't use BigPipe on multilang Drupal 8 sites with language switcher.
Drupal\Core\EventSubscriber\ActiveLinkResponseFilter is used to set "is-active" class on active links for anonymous users:
// There are two distinct conditions that can make a link be marked active:
// 1. A link has the current path in its 'data-drupal-link-system-path'
// attribute.
// 2. We are on the front page and a link has the special '<front>' value in
// its 'data-drupal-link-system-path' attribute.
(ActiveLinkResponseFilter.php)
while authenticated users (plus 403/404) use javascript handling:
// Handle setting the "active" class on links by:
// - loading the active-link library if the current user is authenticated;
// - applying a response filter if the current user is anonymous.
// @see \Drupal\Core\Link
// @see \Drupal\Core\Utility\LinkGenerator::generate()
// @see template_preprocess_links()
// @see \Drupal\Core\EventSubscriber\ActiveLinkResponseFilter
$route_name = \Drupal::request()->attributes->get('_route');
if (\Drupal::currentUser()->isAuthenticated() || in_array($route_name, ['system.404', 'system.403'])) {
$page['#attached']['library'][] = 'core/drupal.active-link';
}
(active-link.js)
This is for example important for the Drupal core language switcher to mark the currently active language.
We were wondering why the language switcher had no .is-active class in some browsers (Chrome, anonymouse) while it worked logged in other browsers (Firefox, Opera, anonymous). I'm not sure if that conditions are met randomly. The problem is definitely server-side but it's unclear when / why it appears!
We're running into the problem with BigPipe in all our multilanguage Drupal 8 sites so the problem definitely exists.
Expected behaviour: The current language is always marked .is-active in the language switcher
8.5.x / 8.6.x behaviour: In some browsers (for us it was Chrome to unknown reasons) the class is missing at all
Postponed: needs info
11.0 🔥
system.module
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
Is this still an issue with modern browsers and Drupal 11? If so, let's get some clear steps to reproduce.