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

bug: auto-sized labels inside a flex container with non-start cross_align, causes misalignment in the cross axis #1098

Open
Aiving opened this issue Feb 7, 2025 · 1 comment
Assignees
Labels
bug 😔 Something isn't working layout 📐 Relate to layout
Milestone

Comments

@Aiving
Copy link
Contributor

Aiving commented Feb 7, 2025

When content: "flex" is used in an auto-sized label, the sizes of child elements using the flex(grow_factor) function start measuring their size incorrectly.

Code for reproduction:

use freya::prelude::*;

fn main() {
    launch(App);
}

#[component]
fn App() -> Element {
    rsx! {
        rect {
            width: "256",
            height: "48",
            padding: "12 5 12 5",
            background: "#999999",

            rect {
                direction: "horizontal",
                spacing: "8",
                cross_align: "center",
                content: "flex",

                rect {
                    width: "flex",
                    main_align: "center",

                    label { "Click Me!" }
                }

                rect {
                    width: "12",
                    height: "12",
                    background: "red",
                }
            }
        }
    }
}
@marc2332 marc2332 changed the title Auto-sized flex Issue: label with auto width in a flex container get 0 width Feb 7, 2025
@marc2332 marc2332 added bug 😔 Something isn't working layout 📐 Relate to layout labels Feb 7, 2025
@marc2332 marc2332 self-assigned this Feb 7, 2025
@marc2332 marc2332 moved this to Todo in Freya Planning Feb 7, 2025
@marc2332 marc2332 added this to the 0.3.0 milestone Feb 7, 2025
@marc2332
Copy link
Owner

marc2332 commented Feb 8, 2025

After some thinking I am not sure this is a bug. You can get the desired behavior by adding a max_lines: "1" to the label

@marc2332 marc2332 removed this from the 0.3.0 milestone Feb 9, 2025
@marc2332 marc2332 moved this from Todo to In Progress in Freya Planning Feb 13, 2025
@marc2332 marc2332 added this to the 0.3.0 milestone Feb 13, 2025
@marc2332 marc2332 changed the title Issue: label with auto width in a flex container get 0 width Issue: auto-sized labels inside a flex container with non-start cross_align, causes misalignment in the cross axis Feb 14, 2025
@marc2332 marc2332 changed the title Issue: auto-sized labels inside a flex container with non-start cross_align, causes misalignment in the cross axis bug: auto-sized labels inside a flex container with non-start cross_align, causes misalignment in the cross axis Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 😔 Something isn't working layout 📐 Relate to layout
Projects
Status: In Progress
Development

No branches or pull requests

2 participants