Skip to content
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

Footer previous/next labels cut-off for short page titles #5290

Closed
4 tasks done
kamilkrzyskow opened this issue Mar 29, 2023 · 4 comments
Closed
4 tasks done

Footer previous/next labels cut-off for short page titles #5290

kamilkrzyskow opened this issue Mar 29, 2023 · 4 comments
Labels
bug Issue reports a bug 🏆 perfect Issue is of outstanding quality resolved Issue is resolved, yet unreleased if open

Comments

@kamilkrzyskow
Copy link
Collaborator

kamilkrzyskow commented Mar 29, 2023

Context

The footer displays incorrectly based on the page width and footer.previous and footer.next text length.
It's more visible on other languages than English, e.g. Polish.

Bug description

There are 2 issues, the first could be just my preference, but I'll still attach it here:

  1. If the page width is too small (mobile-like) then the left footer text disappears. My expectation is that the text will stay, and if there is too little space to display the whole text of both the previous and next buttons, then the next button should move below the previous button. I only fixed the disappearing text to stay like so:
@media screen and (max-width: 44.9375em) {
    .md-footer__link--prev .md-footer__title {
        display: block;
    }
}
  1. The footer.previous and footer.next text gets cut off when the page title is shorter than either of them. The footer.next page title position can also shift a little in line height. The footer.next also isn't aligned to the page title by the right border. One quick fix is to set flex-grow to 0.5 or higher like so:
.md-footer__link {
    flex-grow: 1;
}

Related links

Reproduction

example.zip

Steps to reproduce

  1. Open the example site.
  2. Navigate to B.
  3. Decrease the width of the viewport.
  4. Notice that at some point the Previous button content disappears.

  1. Open the example site.
  2. Navigate to B.
  3. On 1080p, notice that Previous is cut off and only Previou is visible, notice that Next isn't properly aligned with the C title.
  4. Open BBB... and see that Previous is fully visible and that Next is properly aligned with C.
  5. If you need a stronger example, change theme.language to pl.

There is also a video with a "reproduction" in the discussion linked above.

Browser

No response

Before submitting

@squidfunk squidfunk added the bug Issue reports a bug label Mar 29, 2023
@squidfunk
Copy link
Owner

Thanks for reporting, for the excellent reproduction, and for investigating potential solutions! This issue is of outstanding quality, which is why we give it the 🏆 perfect badge! The problem with the direction labels being cut off stems from the fact that they're absolutely positioned and thus don't count towards the computed width of the previous/next link. I did a slight refactoring in f4d894d, removing the absolute positioning, so the widths should now always correctly computed. I tested with very long and very short labels and evaluated your example and think I found all cases. Your questions:

  1. Intended behavior, please see Footer label and title to previous page displayed on Nexus 6P #491 (comment). If you wish to customize it, setting display: flex !important on .md-footer_title should make it always show.
  2. This is a reasonable fix, but it will stretch the buttons towards the center, which means the whole area is clickable. This was the case before the last refactoring, but I think this is not a very good design, because when titles are short, a very large part of the "dead space" is clickable, which might be unexpected. Thus, we removed the stretching behavior and links are now only as wide as necessary. This introduced the problem reported, but it should now be fixed.

@squidfunk squidfunk added resolved Issue is resolved, yet unreleased if open 🏆 perfect Issue is of outstanding quality labels Mar 29, 2023
@squidfunk squidfunk changed the title Navigation footer displays incorrectly Footer previous/next labels cut-off for short page titles Mar 29, 2023
@kamilkrzyskow
Copy link
Collaborator Author

Thank you very much for the in-depth explanation and perfect badge, even though I didn't find the older footer issues (I swear I looked), and broke the rule of 1 issue = 1 GitHub issue ✌️
I downloaded the commit to try it out and everything looks fine 👍

Setting display: flex !important on .md-footer_title together with flex-direction: column results in the same behavior as before (with display: block), at least I don't see any difference. Seeing that modifying flex is the way I tinkered a bit more, and managed to get the Next button below the Previous button via adding flex-flow: wrap to the parent nav. However, it doesn't look as good as I imagined it would 😅. Maybe adding dynamic centering of the button contents would help, but I didn't manage to make it work properly, because the arrows offset the text differently depending on the button 😞.
Anyways it's not that important.


Looking at the flex layout I noticed that the arrows are "aligned with" the page title instead of the whole content. I prefer the latter. I set align-items: flex-start on .md-footer__link
image
image

@squidfunk
Copy link
Owner

squidfunk commented Mar 29, 2023

I replicated the previous layout, which aligns the arrow with the title, as IMHO the direction label can be considered secondary. However, thanks for sharing your adjustment, so other users can apply it if they prefer the centered look ☺️

@squidfunk
Copy link
Owner

Released as part of 9.1.5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue reports a bug 🏆 perfect Issue is of outstanding quality resolved Issue is resolved, yet unreleased if open
Projects
None yet
Development

No branches or pull requests

2 participants