-
Notifications
You must be signed in to change notification settings - Fork 266
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
<br> in Node tooltips should be \n instead to render correctly in Chrome and Edge #251
Comments
Ugh... this issue has caused way more hassle than anything else by far... all just to put a newline in tooltips. see #180 #152 #130 #146 #151 #175 #215 #250 just for starters. The problem is, tooltips were not designed to be multiline, so browsers react differently to whatever hack you use to enable it. Then, SVG titles are not designed to contain HTML, so whatever hack we use to enable that causes various problems and conflicts. We've gone through multiple rounds of trying to get this working on the widest range of browsers, and spent an inordinate amount of time testing and researching options. Frankly, it pains me to imagine reviewing another change that might fix something for someone but break something for everyone else, particularly with this issue that has caused so much trouble before. That being said, since the line for the links is... networkD3/inst/htmlwidgets/sankeyNetwork.js Lines 173 to 174 in 9c0a9c9
and the line for the nodes is... networkD3/inst/htmlwidgets/sankeyNetwork.js Lines 187 to 188 in 9c0a9c9
it seems logical that they should be the same. The main significant difference between the nodes and links is that one is a SVG rect and one is a SVG path, and I can't imagine why that would matter. There's another pending PR #215 that I will hopefully merge soon that may conflict with this change though... he was appending text to the |
and there's some report here #130 (comment) that suggests |
Seems like different browsers are rendering Add new arguments to the The code in For nodes: For links: This way, you can avoid a rash of new bug reports from changing |
My preference would be to make the default delimiter either ": " or " - " for full, safe compatibility. Then maybe add some functionality that would allow a user to set custom code for the tooltips, then they take full responsibility if they want to use |
So that's fine but I would use ": " instead of " - " to avoid confusion with the negative sign (even though negative values don't make sense in a Sankey). If you go this route, then instead of adding the arguments I suggested above for backward compatibility, I would consider adding the ability to provide custom JavaScript functions to render the node and link tooltip text as desired - perhaps through the $options list? |
also of note... using 0.4 release version and the 0.4.9000 dev version of |
Yes, so for example, the defaults could be... |
This is probably the best alternative as it gives the caller the ability to specify what the node/link tooltips should look like while making sure that it at least works in RStudio. Sounds like a plan! |
This is a new issue for an old problem: how text displays in tooltips. For "links", the two lines are separated by a newline character
\n
. For "nodes", the two lines are separated by a<br>
tag.While this works in Safari, it does not appear to work in Chrome or Edge. The
<br>
tag is just ignored and the two lines run together.I believe the answer is simple. In the line below, just replace
<br>
with\n
(like the way links are handled) to fix the problem. I've edited my local copy of sankeyNetwork.js and this now works on Safari, Chrome and Edge.networkD3/inst/htmlwidgets/sankeyNetwork.js
Line 187 in 9c0a9c9
As an aside, I believe using
<br>
should work in Chrome and Edge. I've posted a question on StackOverflow to ask this questionDo you want me to make this change via pull request?
The text was updated successfully, but these errors were encountered: