-
Notifications
You must be signed in to change notification settings - Fork 559
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
Vertical content alignment in containers #134
Comments
Agree we should add it to Column, need to think more about the container card |
Duplicate of #484 |
@Anbare @dclaux @matthidinger What's the difference or what should be different in the behaviour of stretch and top? We currently have stretch for the height property for each element (#484) and this property is supposed to act on all children of a container |
@almedina-ms actually there is no stretch. The spec is out of date. Valid values are top, center and bottom, and the default is top. |
I have updated the spec. |
@dclaux @matthidinger I don't think we ever agreed to NOT have stretch as an option. We need to discuss this one, unless the API board has actually already discussed this offline without discussing it here? The email thread we had on this left off with no conclusion (we didn't get any feedback on it outside of just David and myself). |
@Anbare given we have the height property the stretch value on verticalContentAlignment isn't needed. |
@dclaux I disagree. So we need to have a group consensus, we've already tried convincing each other, it didn't happen. |
@Anbare What is the expected behavior for stretch? |
Here's my info I put together on it previously... We need to decide whether verticalContentAlignment should or should not have a “stretch” value as one of its values (it’ll definitely have “top”, “center”, and “bottom”). Ultimately, both options are functionally-equivalent, meaning that neither option enables any new scenarios. That means the “stretch” value is technically unnecessary. So this decision is purely about what makes more sense from the API perspective, rather than which one is technically superior. Option 1: No "stretch" value
Option 2: "stretch" value
Most of the time, “top” and “stretch” are identical in behavior. It’s only when you also use height: stretch on one of the child elements that there would be a difference. Therefore, imagine you have a card like the following…
If we go with Option 1, then it doesn’t matter what verticalContentAlignment the card author set, since the children content will collectively stretch to fill the height due to that child having a stretch height.
If we go with Option 2, then when verticalContentAlignment is set to anything except “stretch”, the children with stretch heights will essentially become auto heights, since the children content is no longer collectively stretching to fill the height.
So with either option, there's cases where assigning one property will invalidate the other property. It's just a question of which behavior would cause the least confusion. |
@Anbare would you agree that both options allow for the exact same set of layout? Eg there isn't one option that is more powerful than the other, right? Given that, doesn't it make more sense to pick the option that adds the least to the schema? |
I already said that both options are technically equivalent. That doesn't mean we should only pick the option that adds the least to the schema if the other option is less confusing. |
How is having two ways to do the same thing less confusing? Per what you describe, Container.verticalContentALignment = "stretch" is exactly the same as Container.height = "stretch" |
Did you read my big previous post I made? I explicitly showed the behavior of stretch. And I captured both almedina's confusion, and the alternate confusion. Both options have confusion. We need opinions outside of just us. We've already made our arugments, we're not convincing each other. |
Yes, I did read your post. I am very sorry but what you propose is very confusing. In your own drawings, you can see that the container stretches in all three cases. In fact, there is no aligning a container's content center or bottom without the container itself being stretched to a height that is larger than the sum of the heights of its child elements. I do not see how option 1 is confusing:
What you propose just adds a way to do the same thing as setting a container's height property to "stretch." Either that, or I still don't understand what you mean, which to me is a sign that it is inherently confusing. |
I think I got it after re-reading your post a few times. You want the stretch value of the verticalContentAlignment property to be a way to override the height value of the container's elements. Why would it be better to have verticalContentALignment = stretch override the height property of the containers children, rather than have a child's height = stretch override the value of the parent container's verticalContentAlignment? |
That's exactly the question. One of them gets overridden. We have to decide which should override. I'm personally drawing experience from XAML. They also have a VerticalContentAlignment property which has Stretch like I've proposed: https://msdn.microsoft.com/en-us/library/system.windows.controls.control.verticalcontentalignment(v=vs.110).aspx Additionally, I would say that since layout happens from the parents->down, properties at the higher level (verticalContentAlignment) should get precedence (and override) the children properties. |
I fundamentally disagree here. XAML's approach is terribly confusing IMO and I don't see a point in replicating that confusing design. There is no need to have two ways to override things. Plus consider this case:
What do you do?
Bottom line is, verticalContentAlignment = stretch serves the sole purpose of forcing top alignment when some of the children have their height set to stretch. If you don't want your elements to stretch within a container... don't set their height to stretch. |
In the case you described, Option 2 would work as expected without doing either of the two things you mentioned (the content would all appear at the bottom). That case is exactly what I visualized in the last picture of my post. |
That's not true, per your own explanations. The verticalContentAlignment is set to bottom. The only way for me to have it honored is to remove the height = stretch property on my elements. Setting verticalContentAlignment to stretch will override the height property of my elements, yes, but they will all be aligned to the top, which isn't what I wanted to start with. |
Please read my lengthy post once again. In my proposal (Option 2) where "stretch" is an option, if you set it to Therefore, in Option 2, setting Including the picture once again ( |
In my proposal (Option 2), the payload you initially provided already works correctly and produces the visual result you're expecting (both text elements appear at the bottom). You don't have to remove the In your proposal (Option 1), yes, you would have to remove the |
I had indeed misread you, multiple times at that. Now I understand, and it definitely makes a lot more sense than what I thought I had understood. But then again, there is no need to add a "stretch" value... the rule can simply be that when the verticalContentAlignment property is omitted the container behaves like it would with verticalContentAlignment = stretch. I don't think this changes my position though. I think saying height = stretch overrides verticalContentAlignment is just fine. Technically, verticalContentAlignment is still applied for that matter, it's just not visible. It matches the way FlexBox works. |
Documentation is done and in the mahiding/site1.1 branch. |
Implementation status
Problem
Currently, it's not possible to vertical align content within a column (or within a fixed height container like Timeline). Without vertical alignment on the body and containers itself, you won't be able to achieve things like this...
Instead it would look like...
Design
Add a new verticalContentAlignment property to
Container
,Column
, andAdaptiveCard
:Because we are introducing a "height" property, it makes sense to also rename the "size" property of a Column to "width"
Example
Card payload
The text was updated successfully, but these errors were encountered: