From e9aac23db2cd891ed67ff0da4e3c377d08d9da68 Mon Sep 17 00:00:00 2001 From: Lexachoc <20377719+Lexachoc@users.noreply.github.com> Date: Sun, 6 Sep 2026 01:09:44 +0200 Subject: [PATCH 1/2] fix modebar hover colors --- src/lib/dom.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/lib/dom.js b/src/lib/dom.js index b2fc54aaea0..1beabd1b076 100644 --- a/src/lib/dom.js +++ b/src/lib/dom.js @@ -109,22 +109,29 @@ function setStyleOnHover(selector, activeSelector, childSelector, activeStyle, i element = document; } element.querySelectorAll(selector).forEach(function(el) { + el._hoverStyle = { + activeStyleParts: activeStyleParts, + inactiveStyleParts: inactiveStyleParts + }; + if(!el.getAttribute(eventAddedAttrName)) { // Emulate ":hover" CSS style using JS event handlers to set the // style in a strict CSP-compliant manner. el.addEventListener('mouseenter', function() { + var hoverStyle = this._hoverStyle; var childEl = this.querySelector(childSelector); if(childEl) { - childEl.style[activeStyleParts[0]] = activeStyleParts[1]; + childEl.style[hoverStyle.activeStyleParts[0]] = hoverStyle.activeStyleParts[1]; } }); el.addEventListener('mouseleave', function() { + var hoverStyle = this._hoverStyle; var childEl = this.querySelector(childSelector); if(childEl) { if(activeSelector && this.matches(activeSelector)) { - childEl.style[activeStyleParts[0]] = activeStyleParts[1]; + childEl.style[hoverStyle.activeStyleParts[0]] = hoverStyle.activeStyleParts[1]; } else { - childEl.style[inactiveStyleParts[0]] = inactiveStyleParts[1]; + childEl.style[hoverStyle.inactiveStyleParts[0]] = hoverStyle.inactiveStyleParts[1]; } } }); From 630bcf8cd33b8ad30cb47492eef1dc5fbce5589a Mon Sep 17 00:00:00 2001 From: Lexachoc <20377719+Lexachoc@users.noreply.github.com> Date: Sun, 6 Sep 2026 01:18:44 +0200 Subject: [PATCH 2/2] add draftlog --- draftlogs/8024_fix.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 draftlogs/8024_fix.md diff --git a/draftlogs/8024_fix.md b/draftlogs/8024_fix.md new file mode 100644 index 00000000000..014524dac08 --- /dev/null +++ b/draftlogs/8024_fix.md @@ -0,0 +1 @@ +- Fix modebar hover colors not updating after `color` or `activecolor` changes [[#8024](https://github.com/plotly/plotly.js/pull/8024)] \ No newline at end of file