-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
flowchart node label disappears when too wide #5785
Comments
Mitigation turn off htmlLabels when user agent is Firefox:
When it doesn't render:
When it does render:
|
The div being inserted (addHtmlLabel?) is not setting properties I would expect to be set:
According to the code, white-space should be nowrap: mermaid/packages/mermaid/src/rendering-util/rendering-elements/createLabel.js Lines 43 to 47 in 115cb07
|
Thanks for investigating! Indeed setting
|
I'm seeing this as well. Can confirm that the generated elements in the svg are different between the two browsers. flowchart TD
foo[aaaaaaaaaaaaaaaaaaaaaaa]
firefox: <g transform="translate(0, 0)" style="" class="label"><rect></rect><foreignObject height="0" width="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: table; white-space: break-spaces; line-height: 1.5; max-width: 200px; text-align: center; width: 200px;"><span class="nodeLabel"><p>aaaaaaaaaaaaaaaaaaaaaaa</p></span></div></foreignObject></g> vs chrome: <g transform="translate(-102.3359375, -12)" style="" class="label"><rect></rect><foreignObject height="24" width="204.671875"><div style="display: table; white-space: break-spaces; line-height: 1.5; max-width: 200px; text-align: center; width: 200px;" xmlns="http://www.w3.org/1999/xhtml"><span class="nodeLabel"><p>aaaaaaaaaaaaaaaaaaaaaaa</p></span></div></foreignObject></g> Both from the mermaid-js live editor, but the github renderer is also affected. |
Github updated to the latest version of Mermaid (v11.1.0), this caused an issue with our graph in `README.md`. Specifically, it does not support `\n` for breaking lines anymore (probably caused by the [introduction of new string syntax](mermaid-js/mermaid#4271)). This problem was fixed by replacing `\n` with `<br/>` In the case of Firefox, there is a problem that for long labels the whole label has disappeared ([issue](mermaid-js/mermaid#5785)). In case of Chrome, long labels were autowrapped which caused not good rendering. To fix this problem the font size of clusters were decreased.
- Use <br/> instead of \n. For some reason, the latter apparently stopped working (both in the mermaid live editor and on github) -- before \n would cause a linebreak, but now it just causes the literal text \n to show up in the flowchart (which is funny, but not what I want here...) See https://stackoverflow.com/q/51366763 for some discussion on this -- including an answer from 2022 where someone says that \n works! - The newer version of mermaid introduced a bug where nodes with long labels just straight-up don't have the label show up anymore: mermaid-js/mermaid#5785 This impacted the "strainFlye call p-mutation" and "strainFlye call r-mutation" nodes. This will probably be fixed eventually on mermaid/github's side, but for now the workaround is just manually adding linebreaks to those node names. Sidenote about that github issue link above: it includes a pointer to PLukas2018/diffkemp@6aae129, where someone else fixed the exact two problems above. this indicates that these issues are due to the mermaid version update.
this is really broken for me, when i try and do:
flowchart TD
CheckStatusForTriggerProcessingPath[CheckStatusForTriggerProcessingPath]-->CheckStatusForTriggerProcessingPath_CheckStatusForTrigger[CheckStatusForTriggerProcessingPath_CheckStatusForTrigger]
TriggerSwitchingProcessingPath[TriggerSwitchingProcessingPath]-->TriggerSwitchingProcessingPath_ValidateRegistrationFlowStart[ValidateRegistrationFlowStart]
TriggerSwitchingProcessingPath[TriggerSwitchingProcessingPath]-->TriggerSwitchingProcessingPath_TriggerSwitchingProcess[TriggerSwitchingProcessingPath_TriggerSwitchingProcess]
CheckStatusForTriggerProcessingPath[CheckStatusForTriggerProcessingPath]-->TriggerSwitchingProcessingPath[TriggerSwitchingProcessingPath]
|
Description
Since mermaid 11.0.0 (I tested that it does not occur on 10.9.1), on firefox, when I render a flowchart with somewhat long node labels, the node becomes an empty square.
However, on Chrome and Edge, it works fine, even with much larger content.
Steps to reproduce
Screenshots
See on the right that there is no big box of multiple lines of 'a', no subgraph title, and not the second node in the subgraph with '.iiiii(...)'. From the different number of a's vs i's needed to trigger this, it seems to have to do with the width, not the number of characters.
Doing the same on chrome, with even more text:
Code Sample
https://mermaid.live/edit#pako:eNrtVMFuwjAM_ZXIpyGVqm1aCNGEtGnXnbbTyA6hCTSCJihNxRji35emoEnTOm0745P17Oc4fomPUBohgcJqa_Zlxa1Dz_dMM43Q3thNky4Y8G_tdmnn18hQhMHr5wzReDzvXYw6tGmXa8t31QUbnPG5CkJCWVk6ZXRQp0MCNbsZZo66PKlFL-aSi9Qn310V-4-Wo8sIg5Le-aJjQBaD4_1BxpVyjddF_c7OnYRePCv-Gy08BoiglrbmSvhPf-xgBq6StWRAvSu43TBg-uTzeOvM00GXQJ1tZQTtTnAnHxT3l66Brvi28eiOa6BHeAM6zoq4mCRTgjGZZDjJpxEcgKYZiTFOSU7SPC9wmhWnCN6N8SWSmMzy2aSYTTHJkiQhRQRSKGfsY7-VwnIKZ7wEQt-INe26Ojdw-gCP2af3
Setup
Suggested Solutions
No response
Additional Context
I think this may relate to #5698, but I wanted to provide more complete information so opened a new ticket anyway.
The text was updated successfully, but these errors were encountered: