-
-
Notifications
You must be signed in to change notification settings - Fork 3.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
Text in mermaid diagrams overflows in Firefox #4429
Comments
I can reproduce the issue to some degree using Firefox when viewing the example in Mkdocs Material's official page. With that said, I do not experience this issue with my own personal implementation of Mermaid when viewing the same diagram in Firefox. I'm not exactly sure if this is related to MkDocs scaling the images and my documentation not scaling them or some other option. But, what I am certain of, is that this overflowing of text content can be avoided as I've not had this issue. I haven't dug into Materials default options for Mermaid, but I'd be curious as to how it differs from what I'm doing. |
Thanks for reporting. I can reproduce the problem when viewing the diagram with Firefox, but I can't locate the problem. It should be fixable since @facelessuser has it working, but I'm not sure how. Maybe somebody else has a good idea. The Mermaid.js code is very simple and located here. Even when I remove all custom styles, the issue persists. Maybe it has something to do with the fact that we load Mermaid.js on demand and use a slightly unorthodox method of initialization. |
Good news, I think I found the problem. The sequence diagram computes positioning and offsets based on font sizes. 60ea10a sets the font sizes to the ones we use, fixing the issue. Yet, it is super weird that this is only happening in Firefox. |
Released as part of 8.5.4. |
Yep, that turned out to be the exact fix I had done in my code, which I see is now why I did not have the same issue. Apparently, I had even documented it: sequence: {
useMaxWidth: false,
// Mermaid handles Firefox a little different.
// For some reason, it doesn't attach font sizes to the labels in Firefox.
// If we specify the documented defaults, font sizes are written to the labels in Firefox.
noteFontWeight: "14px",
actorFontSize: "14px",
messageFontSize: "16px"
}, |
I didn't mention, but yes, I've looked up your solution and adapted it 😅 For us, the configuration is slightly different because we use different font sizes. It's so unfortunate that Mermaid.js is so inconsistent that this is necessary, though. |
Oh, that makes sense. I was just curiously looking to see if I had inadvertently done the same thing on accident, then I saw the comment and realized I had done it purposely, not accidentally 🙃. |
Contribution guidelines
I've found a bug and checked that ...
mkdocs
orreadthedocs
themescustom_dir
,extra_javascript
andextra_css
Description
I'm using mermaid sequence diagrams and seeing some issues on Firefox vs Chrome:
Expected behaviour
The text is displayed in the same way as in Google Chrome in any browser:
Actual behaviour
on Firefox vs Chrome:
Steps to reproduce
This can be reproduced on the main docs (just open it in Firefox but not Chrome): https://squidfunk.github.io/mkdocs-material/reference/diagrams/#using-sequence-diagrams
In this example the note is small but if it will be bigger than it would not fits inside the block
Package versions
This can be replicated on the main docs
Configuration
This can be replicated on the main docs
System information
MacOS 12.2.1 (21D62) Monterey
The text was updated successfully, but these errors were encountered: