-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
List View: Update drop indicator width to be aware of scroll containers #49786
List View: Update drop indicator width to be aware of scroll containers #49786
Conversation
Size Change: +49 B (0%) Total Size: 1.37 MB
ℹ️ View Unchanged
|
Flaky tests detected in e3d5014. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4685285531
|
Also that it's rendered in a slot outside the scroll container, so it doesn't respect CSS overflow rules. I think this is probably good as a temporary fix, but it does seem like it'll add some extra computational expense. There might be some other alternatives:
|
Oh, cool ideas! Yes, I was mostly imagining this fix as a shorter term solution since it's a bit of an unfortunate visual issue at the moment. If the approach in this PR isn't a blocker, I'd be happy to dig into some of these other alternatives once we're a little further along with some of the other list view improvements. At least on the surface, it looked like most of the ideas I had wound up being some variant of needing to grab the container via |
@andrewserong I am still seeing the line extend past in both Chrome and Safari. I'm pretty positive I've followed the instructions exactly and have the changes built correctly. 🤔 |
@apeatling thanks for taking this for a spin! It currently only works once the list view extends beyond the vertical edge of the screen. Before this PR can land, I think we'll need to land the fix in #49787 first. Once that's in, I'll give this a rebase and update and then ping for another round of reviews 🙂 |
ac0fcb2
to
81f8ade
Compare
Update: #49787 has been merged, so I've given this a rebase, and it should be ready for a final review now. |
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.
Thanks for re-reviewing! I'll merge this in now. |
What?
Fix an issue where the list view drop indicator's width extends beyond the edge of the list view when the list is deeply nested.
Why?
The cause is two things:
350px
sidebar.So, to support the drop indicator in deeply nested list views, let's reduce the width of the drop indicator so that it doesn't extend beyond the scrollable area.
How?
In the list view drop indicator code, attempt to grab the scroll container, and if the scroll container's width (
scrollContainer.clientWidth
) is narrower than the width of the target element, then use that width to calculate the final width of the drop indicator line (factoring in the spacing between the left edge of the container and the left edge of the target element).Known issue:
getScrollContainer
currently only looks at the vertical axis for determining whether a container is present. So for this PR to work, you need a list that extends beyond the height of the screen vertically. Separately to this PR, I'll put up a fix forgetScrollContainer
.Testing Instructions
Some heavily nested block markup for testing
Screenshots or screencast