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

Using 'align-self' seems hacky #2

Open
tabatkins opened this issue Oct 6, 2017 · 2 comments
Open

Using 'align-self' seems hacky #2

tabatkins opened this issue Oct 6, 2017 · 2 comments

Comments

@tabatkins
Copy link

The place-self properties align an element in its container. Start/end put it against the start/end edge, etc. None of the alignment properties align a single element wrt sibling elements unless they're doing a global alignment of all the elements in a container/line (the space-* values).

As such, I don't think align-self is the right place for "align this one element within its siblings". It's squeezing in a different concept in a way that I think will bite us later.

@dbaron
Copy link
Owner

dbaron commented Oct 6, 2017

I guess it seemed the opposite to me -- it seem like this was a case where align-self didn't do anything and probably wasn't going to, except for this case, where we can actually make it do something useful that pretty much matches what it does.

@tabatkins
Copy link
Author

The problem here is that the property then becomes context-dependent. In some cases it aligns the element within its container. In other cases it aligns an element among its siblings, relative to the line-grid. And since it's reusing the same keywords, you have to know exactly what context the element is in to understand what the property is trying to do.

This sort of bimodal design feels attractive (as you say, it's making a property do something useful in a case where it's currently not doing anything), but it's a trap! It just makes things more difficult to understand, and constrains us in how we can evolve the property in the future. (For example, you're already saying that in the line-grid context, only three keywords do anything; the rest are meaningless. Similarly, if we ever have to add more line-grid-specific controls to this property, we'll have to define that in the container-aligning case, those keywords are meaningless.)

It also means that we can't ever cross the streams, and, for example, align a grid item to the line-grid, or a flex item to the line-grid in the cross axis (it might be possible in the main axis, as it doesn't currently respond to justify-self).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants