The Wayback Machine - https://web.archive.org/web/20220216131216/https://github.com/dotnet/aspnetcore/issues/40262
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

Simplify virtualize in flex by setting flex-shrink:0 on placeholders automatically #40262

Open
1 task done
SteveSandersonMS opened this issue Feb 16, 2022 · 0 comments
Open
1 task done

Comments

@SteveSandersonMS
Copy link
Member

@SteveSandersonMS SteveSandersonMS commented Feb 16, 2022

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe the problem.

If you use display:flex on a scroll container, then its child elements will by default automatically shrink to the size of their content even if you have height: someLargeValue. To avoid this you must specify flex-shrink:0 for the child elements.

The Virtualize component is adversely affected by this, because its placeholders contain no content, and therefore by default will shrink to zero height if you have display:flex on the container. This was reported at #40123

Describe the solution you'd like

The generated placeholder elements should have flex-shrink: 0 automatically. As far as I'm aware, there's no drawback in doing this even when the parent isn't display:flex, because it would just be ignored in that case.

We could either do this on the JS side by adding the style automatically inside the mutation observer (like we already apply the display: table-row style automatically in some cases). Or we could do it on the .NET side by hardcoding flex-shrink: 0 into the style attribute that we already generate for the height.

Additional context

Until this is done, it would be helpful to add a note to the docs about it. PR: dotnet/AspNetCore.Docs#25041

SteveSandersonMS pushed a commit to dotnet/AspNetCore.Docs that referenced this issue Feb 16, 2022
Describes an additional requirement that was omitted before. This additional requirement will stop being required (and hence this doc change can be reverted) in future versions if we implement the enhancement dotnet/aspnetcore#40262
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant