mirror of
https://github.com/rivo/tview.git
synced 2026-04-26 21:35:54 +03:00
[GH-ISSUE #658] The flexbox directions are reversed #481
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tview#481
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @franeklubi on GitHub (Sep 29, 2021).
Original GitHub issue: https://github.com/rivo/tview/issues/658
Repr code:
Expected behaviour:
The
LeftandRightboxes to be on the left and right side of the terminal.Actual behaviour:
The
LeftandRightboxes are placed on the up and bottom sides of the terminal.My expectations are guided by experience, but here's the MDN reference for flexbox axes:
https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Flexible_Box_Layout/Basic_Concepts_of_Flexbox#the_main_axis
Is this the expected behavior of tview flexbox axes? If so, why? This doesn't make much sense to me.
@ghost commented on GitHub (Sep 30, 2021):
By default, Flex adds item column-wise. You have explicitly set the direction to row-wise using
Flex.SetDirection(). Here's the same code without.SetDirection(tview.FlexRow):@franeklubi commented on GitHub (Sep 30, 2021):
@ka1r03 Yes, I know, but that still doesn't mean the confusion is resolved.
Since I need a couple of flexboxes in various directions, when I set them I expect different output.
@rivo commented on GitHub (Sep 30, 2021):
You might be right. The semantics in
tvieware different from CSS. To be honest, the CSS one always confused me and I guess this was also the case right at the timetviewwas implemented. My intuitive understanding is that a "row" direction means "one item per row". But in CSS, it's not, so I always have to look it up. (Seriously, I always need to look up the properflex-directionvalue because it's so confusing to me.)Unfortunately, it's too late to change it now. So, in
tview, "row" means "one item per row" and "column" means "one item per column".@franeklubi commented on GitHub (Sep 30, 2021):
That's what I thought :/
One little suggestion that would help clear this issue up is to update the docs and/or add new consts alongside FlexRow and FlexColumn that represent CSS flexbox directions. Although the second one may bring even more confusion, so updating the docs may be sufficient.
Anyway, thank you for the explanation!
@rivo commented on GitHub (Oct 29, 2021):
I did that with the latest commit. Cheers.