summaryrefslogtreecommitdiffstatshomepage
path: root/core/modules/toolbar/js
diff options
context:
space:
mode:
authorAlex Pott <alex.a.pott@googlemail.com>2018-12-26 20:37:48 +0100
committerAlex Pott <alex.a.pott@googlemail.com>2018-12-26 20:37:48 +0100
commitd2989e436698ad62a9940f25dd044ed207983242 (patch)
treeac719405c311938f57912e18eccf43da23c6cf2e /core/modules/toolbar/js
parentf261f256e73a428b2b96301b3ab0a8527576b827 (diff)
downloaddrupal-d2989e436698ad62a9940f25dd044ed207983242.tar.gz
drupal-d2989e436698ad62a9940f25dd044ed207983242.zip
Issue #2952626 by Daniel Korte, tstoeckler, romainj, John Pitcairn: Toolbar tab click potentially accessing wrong element due to JavaScript event delegation
Diffstat (limited to 'core/modules/toolbar/js')
-rw-r--r--core/modules/toolbar/js/views/ToolbarVisualView.es6.js4
-rw-r--r--core/modules/toolbar/js/views/ToolbarVisualView.js4
2 files changed, 4 insertions, 4 deletions
diff --git a/core/modules/toolbar/js/views/ToolbarVisualView.es6.js b/core/modules/toolbar/js/views/ToolbarVisualView.es6.js
index e263810daa5..6d9350a8313 100644
--- a/core/modules/toolbar/js/views/ToolbarVisualView.es6.js
+++ b/core/modules/toolbar/js/views/ToolbarVisualView.es6.js
@@ -145,9 +145,9 @@
onTabClick(event) {
// If this tab has a tray associated with it, it is considered an
// activatable tab.
- if (event.target.hasAttribute('data-toolbar-tray')) {
+ if (event.currentTarget.hasAttribute('data-toolbar-tray')) {
const activeTab = this.model.get('activeTab');
- const clickedTab = event.target;
+ const clickedTab = event.currentTarget;
// Set the event target as the active item if it is not already.
this.model.set(
diff --git a/core/modules/toolbar/js/views/ToolbarVisualView.js b/core/modules/toolbar/js/views/ToolbarVisualView.js
index 6b4ce21cc6f..5b3fb6a3271 100644
--- a/core/modules/toolbar/js/views/ToolbarVisualView.js
+++ b/core/modules/toolbar/js/views/ToolbarVisualView.js
@@ -62,9 +62,9 @@
return this;
},
onTabClick: function onTabClick(event) {
- if (event.target.hasAttribute('data-toolbar-tray')) {
+ if (event.currentTarget.hasAttribute('data-toolbar-tray')) {
var activeTab = this.model.get('activeTab');
- var clickedTab = event.target;
+ var clickedTab = event.currentTarget;
this.model.set('activeTab', !activeTab || clickedTab !== activeTab ? clickedTab : null);