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

UI example scrolling list Fix #8061

Closed

Conversation

ickshonpe
Copy link
Contributor

@ickshonpe ickshonpe commented Mar 12, 2023

Objective

Fix for the scrolling list in the UI example.

The upgrade to Taffy 3 broke the scrolling list because in Taffy 3 Dimension::Undefined is removed and Val::Undefined is mapped to Dimension::Auto. The example was giving the list container a max height of Val::Undefined which previously in Taffy internally would have been translated to Dimension::Points(0.) but now becomes Dimension::Auto which means that instead of taking the height of its parent, the list container takes the height of its content, that is the height of the entire list. So the list widget believes that the list fits inside the container and can't be scrolled.

Fixes #8056

Solution

Set the height constraint of the list's container to zero so it doesn't automatically take the height of its content and break the list widget.

Changelog

  • Changed the height constraint of the node containing the list to Val::Px(0.), so it doesn't take the height of its content and break the list widget.

…doesn't take the size of it's content and break the list widget.
@ickshonpe ickshonpe changed the title Changed size of the node containing the list to Val::Px(0.), so it doesn't take the size of it's content and break the list widget. Fix for UI example's scrolling list Mar 12, 2023
@ickshonpe ickshonpe changed the title Fix for UI example's scrolling list UI example scrolling list Fix Mar 12, 2023
@alice-i-cecile alice-i-cecile added C-Examples An addition or correction to our examples A-UI Graphical user interfaces, styles, layouts, and widgets C-Bug An unexpected or incorrect behavior labels Mar 12, 2023
@alice-i-cecile alice-i-cecile requested a review from rparrett March 12, 2023 18:56
Copy link
Contributor

@rparrett rparrett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes the issue for me. Cool that this is just a broken example.

The scrolling implementation seems slightly confusing to me. I would personally expect the "inner container" to expand to the height of the content, and for the scrolling system to be using the height of the outer container for its calculations instead.

I might look into that as a follow-up.

@rparrett
Copy link
Contributor

I took a close look and it seemed simpler than I initially thought to fix up the implementation so I opened #8069 as a potential alternative.

@nicoburns
Copy link
Contributor

I would personally expect the "inner container" to expand to the height of the content, and for the scrolling system to be using the height of the outer container for its calculations instead.

I would also expect this. And as such, I believe we should go with the fix in #8069 instead of this one.

@ickshonpe ickshonpe closed this Mar 13, 2023
@ickshonpe
Copy link
Contributor Author

Closed in favour of #8069

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-UI Graphical user interfaces, styles, layouts, and widgets C-Bug An unexpected or incorrect behavior C-Examples An addition or correction to our examples
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Scrolling in ui example doesn't work
4 participants