-
Notifications
You must be signed in to change notification settings - Fork 203
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
Change layout to fix missing scrollbar highlighting (chromium) Attempt 2 #637
Conversation
7558cf1
to
d15f8fb
Compare
d15f8fb
to
b4dba04
Compare
@cynecx can you post some screenshots of what this looks like? |
This is super weird. O.o But today I learned something new so I'm quite happy! :) So I confirmed two things: it doesn't break anchors and the theme picker button is still where it's supposed to be. Is there anything else to be checked? |
@GuillaumeGomez Welcome to the world of CSS and whatever the fuck is going on. Oh, I've just realized that the line numbers anchors (source code view) is still broken, but it can be fixed with the same workaround: // Fix for anchors, so that they are well positioned right below the sticky header
.line-numbers > *::before {
display: block;
content: "";
height: $top-navbar-height;
margin-top: (-$top-navbar-height);
} However, I am having a bad feeling that this might bloat the DOM tree somehow, when we are displaying a large file for example? Other than that, this seems to work well too. Also perhaps this is more less of a problem, so we can just leave it as it is, but that's just my opinion. |
Maybe #595 ? That's hard to test without an iPhone though and is kind of a separate issue so I'm ok with not fixing it in the same PR. |
@jyn514 I've just tested docs.rs (without this PR) on my iPhone (7 + iOS 13.3) and it works just fine and scrolling feels like how it should be (smooth? I guess). |
This is a real nightmare... But at least it seems to be working. @jyn514 Should we give it another try? |
I think #595 might only show up on iOS 12. Anyway it shouldn't block this PR, I'm happy with it if @GuillaumeGomez is. |
Sure, let's go for it. |
@cynecx can you add the same CSS fix for Side note: I'm worried that we'll keep whacking moles for a while. Is there maybe a better solution that would work for all headers at once? |
@jyn514 Yeah I will look into it, but I have to agree, this is a nightmare... xD |
The problem here is that rustdoc generates HTML that doesn't care about being embedded (because of the left menu mainly). And when I wrote most of the HTML, I have to admit that I didn't think about it at all. Even less when the first mobile issues appeared. :) |
Well, I've tried several things, the most "promising" was this one: // Fix for anchors, so that they are well positioned right below the sticky header
// FIXME: This is a hack and should be replaced with a proper solution.
h1[id]::before, h2[id]::before, h3[id]::before, h4[id]::before, h5[id]::before, h6[id]::before {
display: block;
content: "";
height: 3rem;
margin-top: -3rem;
}
// Due to the anchor fix and sub-optimal rustdoc css, the method collapser is mispositioned.
// FIXME: Workaround by applying a top margin.
.method > a[class="collapse-toggle"] {
margin-top: 3rem;
} However this causes issues like: Notice the large left margin. This is due to (A workaround for this would be to wrap the inner flexbox elements within a new wrapper so the Overall I can say that this is not worth the complexity, this requires a more thorough rework of what rustdoc produces. In the meantime, I would propose simply adding more EDIT: #640 |
See the previous PR (#635 ) for more insights. However this PR includes a fix for the broken anchors, which is now fixed. The solution was borrowed from the bootstrap css framework. thanks.