-
Notifications
You must be signed in to change notification settings - Fork 326
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
use ellipsis to truncate breadcrumbs, and test with playwright #1861
Conversation
c7bdc60
to
4ad3ecd
Compare
I love this work! Also. Breadcrumbs. Hansel. Gretel. Hehe. I took a stab a while back at using the trinity of text-overflow: ellipsis, overflow: hidden, and white-space: nowrap, and I remember being miffed at it not working. Then I started fiddling with the So I'm sure this pull request involved quite a bit of pulling at the strings to untangle the knot. But there's still an issue. On a narrow mobile screen, if an intermediate (i.e., not last) breadcrumb is long, it will push off the screen: But I think I have the fix. It requires allowing the breadcrumbs as a whole to wrap, but truncating any breadcrumb whose line goes too long. Mind if I push the commit? (I've accounted for making sure the breadcrumbs don't bleed into the article title, as shown in #1451.) |
Go for it! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some self review comments
@@ -5,7 +5,7 @@ ul.bd-breadcrumbs { | |||
list-style: none; | |||
padding-left: 0; | |||
display: flex; | |||
flex-wrap: nowrap; | |||
flex-wrap: wrap; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed this line to allow the breadcrumb component as a whole to wrap across multiple lines. (But each individual crumb can take at most one line, given the following the rules.)
@@ -14,16 +14,12 @@ ul.bd-breadcrumbs { | |||
display: flex; | |||
align-items: center; | |||
white-space: nowrap; | |||
flex-shrink: 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of flex-shrink here, I use overflow-x to make sure that the breadcrumb part can take up at most one line
|
||
&.active { | ||
flex-shrink: 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my testing, this flex-shrink rule wasn't needed, so I removed it
a, | ||
.ellipsis { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now the text-overflow: ellipsis
rule applies to all the breadcrumbs not just the last/current one
align-items: start; | ||
gap: 0.5rem; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These rules have no meaning after display: flex
was deleted, so I deleted them.
@@ -4,13 +4,6 @@ | |||
// The items define the height so that it disappears if there are no items | |||
.header-article-item { | |||
min-height: var(--pst-header-article-height); | |||
height: var(--pst-header-article-height); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing the height rule should prevent the issue in #1451, in which the breadcrumbs overlap the article title
tests/test_playwright.py
Outdated
@@ -9,19 +9,6 @@ | |||
playwright = pytest.importorskip("playwright") | |||
from playwright.sync_api import Page, expect # noqa: E402 | |||
|
|||
# Important note: automated accessibility scans can only find a fraction of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this comment was accidentally pasted here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With my last push, the breadcrumbs for the same page in the above screenshot now takes three lines instead of one, but any individual breadcrumb part that takes more than one line (the middle line in this example) gets truncated with an ellipsis:
My personal feeling is that the breadcrumb should always be only one line, and we should, if necessary, elide multiple intermediate levels with ...
and also truncate the final level with ...
. But if we're going to take the approach here (of letting breadcrumb elements be on separate lines) then we should probably (?) disable the "skipping some levels in the middle" ellipsis:
In other words, to me the point of skipping some of the middle levels is to make it all fit on one line; if fitting on one line is no longer the goal, we shouldn't conceal intermediate levels.
Perhaps the ideal approach would be for the whole trail to be on one line, and the intermediate ...
would be clickable, and when clicked, would expand the trail onto multiple lines.
All that said: unless @gabalafou fully agrees and wants to tackle that now, I'm OK to merge this as-is as a clear improvement, and transfer this comment to a new issue as a "possible future refinement"
Heh, I'm curious how we ended on completely opposite preferences. In my mind, the breadcrumbs are there to help me understand where I am in the hierarchy. Having intermediate ellipses somewhat defeats that purpose. In theory (or at least in my head), the breadcrumbs become even more important on mobile because you don't have the top nav and sidebars to help you stay oriented, but if a narrow screen and a constraint to keep it on one line causes even more elision, then I begin to wonder what purpose the breadcrumb component even serves on mobile.
Totally agree with you here, though. :) |
I think mine is aesthetic: I don't like breadcrumbs as a means of navigation, so I think they should take up as little space as possible (to stay out of my way). But my preferences should not hamstring other users' ability to navigate sites. So after some further thought, I think we should definitely remove the intermediate ellipsis, ideally as part of this PR, so that folks who do use breadcrumbs can do so effectively. If we do re-introduce the intermediate ellipsis later, we should probably only do so if we also make them click-to-expand-able, or perhaps add a theme option whether to enable intermediate breadcrumb elision. Since both of those directions introduce considerable complexity, there should probably be some brainstorming / community input first. @gabalafou are you up for removing the intermediate ellipsis logic? If not I can try to get back to it sometime soonish. |
Great, agree! I cannot get to the intermediates this week, but I could get to it next week |
Co-authored-by: Madicken Munk <[email protected]>
…wright.py co-authored-by: Madicken Munk <[email protected]> co-authored-by: Paul Ivanov <[email protected]>
5fe965f
to
b2f2510
Compare
done in b2f2510 @gabalafou ready for review/merge. (also sorry for the rebase + force-push; I rebased while attempting to fix mysterious local test failures, which turned out to have been caused by something else entirely) |
I think it's looking good. I pushed a commit to add margin, otherwise we lose the focus ring |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gabalafou I'll let you merge if you're happy. Thanks @ivanov and @munkm !!
I'm guessing this shoudl wait for 0.15.4 right ? |
0.15.4 is out, merging. |
Just wondering, were the tests added in this PR still passing after all of the changes we made? Seems odd... |
the late-breaking changes (letting each breadcrumb item be on its own line) are unlikely to have broken the tests because the test was extreme about setting very large (1440px) & very small (150 px) viewports to trigger the absence/presence of ellipsis. |
This PR:
overflow: ellipsis
joint work with @munkm and @drammock
closes #1583
closes #1568
lays groundwork for addressing #229