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

Toolbar tab click potentially accessing wrong element due to JavaScript event delegation

$
0
0

Problem/Motivation

The user menu link of the toolbar is not working properly with the BigPipe module. I installed Drupal 8.5.0 with the standard profile and when I click the user menu link of the toolbar the page refreshes instead of opening the toolbar menu tray. When BigPipe is not installed everything is working fine.

When BigPipe is enabled, the toolbar username/My account tab title is rendered via #lazy_builder => ['user.toolbar_link_builder:renderDisplayName', []], (line 1373 of user.module) which, once rendered, wraps the username in a div tag. This new child element of the anchor tag prevents the toolbar menu tray from opening when directly clicked on. Clicking around the username text works since that bypasses the div element.

Proposed resolution

The JavaScript to trigger the menu tray opening uses event.target (which is the div tag when clicking on the username text) instead of event.currentTarget (the anchor tag). Changing the target fixes the issue and the tab behaves like all other toolbar tabs with menu trays whether children exist or not.

Remaining tasks

User interface changes

API changes

Data model changes


Viewing all articles
Browse latest Browse all 291765

Trending Articles



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