-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
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
CodeBlock Horizontal Scroll Could Be Improved #2522
Comments
No it's not critical, just nicer looking. Also that gif doesn't look like the same element, there's no outer darker container with the lighter inner container |
It really should not be, this is a record from v2 website, which uses the latest version D2. |
Hmm odd, this is the link to our docs which I just redeployed with the latest alpha. Maybe it's a different component? I noticed CodeBlock in the classic theme didn't use code/pre but that's what's rendered for me there |
It looks like you are not using the latest version, as we have added a version name to the meta tag. For example, on website of v2:
In the source code by your link does not specify the version at all:
|
Weird, I'll double check when I get back to my computer. Thanks! |
So I'm definitely on alpha 50 and this may be why it's not showing up in the meta tag https://github.com/facebook/docusaurus/blob/master/packages/docusaurus/src/client/templates/index.html.template.ejs#L6. I was able to get it looking like your gifs if I use |
The new code block does still have the problem where the right edge, when scrolled, doesn't have padding (on macos on FF, Chrome, and Safari). I think this is due to just how CSS overflow/padding works. Which is one of the same problems I first had, but again not critical. This could be improved by making the outer element (.mdxCodeBlock > div) the scrolling element with the padding and background color. |
This has been fixed in #2533
This template applies to SPA, so when you are building your website, another template is used, in which the version of Docusaurus will be indicated in the meta generator tag. |
@JaceHensley can I close this issue? You can see the website v2, it uses the latest version of D2, if there are no issues with displaying code blocks, then most likely the matter is in the local setup of your site. |
In order to reduce staled issues, I am closing this issue, but feel free to open it again if you run into this again. |
🐛 Bug Report
Currently the CodeBlock contents scroll when too long, but the way it looks could be improved. Right now
Have you read the Contributing Guidelines on issues?
Yes
To Reproduce
Expected behavior
The CodeBlock's inner content should be scrolled not the container that holds it
Actual Behavior
The inner container itself is scrolled
Your Environment
Reproducible Demo
Current:
Proposed:
My proposal to fix this is to add another
<div>
inside the<code>
element and addoverflow: scroll; padding-bottom: 1rem
and then on the<code>
block addwidth: 100%; padding-bottom: 0;
. This way the padding around the on the code is respected when scrolling it's contentsThe text was updated successfully, but these errors were encountered: