-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
ensure we create only one modebar-container
#3678
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
src/plot_api/plot_api.js
Outdated
@@ -3802,6 +3802,7 @@ function makePlotFramework(gd) { | |||
.classed('gl-container', true); | |||
|
|||
fullLayout._paperdiv.selectAll('.main-svg').remove(); | |||
fullLayout._paperdiv.selectAll('.modebar-container').remove(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We remove the existing modebar because:
plotly.js/src/plot_api/plot_api.js
Lines 3792 to 3796 in 3e9d162
// Make the graph containers | |
// start fresh each time we get here, so we know the order comes out | |
// right, rather than enter/exit which can muck up the order | |
// TODO: sort out all the ordering so we don't have to | |
// explicitly delete anything |
src/plot_api/plot_api.js
Outdated
@@ -3802,6 +3802,7 @@ function makePlotFramework(gd) { | |||
.classed('gl-container', true); | |||
|
|||
fullLayout._paperdiv.selectAll('.main-svg').remove(); | |||
fullLayout._paperdiv.selectAll('.modebar-container').remove(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.select
should suffice here, as there's only one <div.modebar-container>
per graph.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 567edde
expect(hoverlayer.length).toBe(1); | ||
|
||
var compareMask = infolayer[0].compareDocumentPosition(modebar[0]); | ||
expect(compareMask).toBe(Node.DOCUMENT_POSITION_FOLLOWING, '.modebar-container appears after the .infolayer'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow. I didn't know that thing existed. NICE!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Me neither! Just found out about them today: https://developer.mozilla.org/en-US/docs/Web/API/Node/compareDocumentPosition 😄
Thanks for the quick fix 💃 |
Closes #3677