-
Notifications
You must be signed in to change notification settings - Fork 364
Use a flex layout for the tree-view-resized div #579
Conversation
This change does not impact how the tree-view render, but will allow other packages to insert new content in the `tree-view-resizer` div without having to worry about the layout being broken or the list not scrolling to the last item (as the list can be pushed by the additional content). For instance `autohide-tree-view` sets the height using something like `calc(100% - 29px)` which maybe fine if it’s the only package. But it starts to get ugly when different packages insert content in the tree-view with different methods (see abe33/atom-tree-view-breadcrumb#19 for instance).
cc @simurai for 👀 |
👍 on changing to flexbox.
Right. I tried out I guess we can remove I'll try that out. |
instead of 100% height. This allows for other packages to share the available space.
It would be better as this change won't be visible as long as we force a display
Yes I got one too, there was a change in the For |
Once atom/tree-view#579 will be merged the tree-view will use a flex layout by default, so this won't be necessary. Also, the fact that you use `!important` for the display property break a fix introduced in the tree-view to force a redraw of the scrollbars when the Atom themes are changed (by toggling the visibility of the tree-view sing a `display: none`).
@simurai What do you think about specifying a value for the Actually that's what I do for in the breadcrumb package because I don't want to rely on the node order (I use an order of 2 for the tree-view-resizer, 1 for the breadcrumb so that element without an order are displayed above both the breadcrumb and the tree-view). |
Ya, that's a good idea. Should it be done with classes? To make it feel more "API like": .tree-view--top { order: 0; }
.tree-view--center { order: 1; }
.tree-view--bottom { order: 2; } The tree-view would be in the center: or attributes: .tree-view-resizer > [data-position="top"] { order: 0; }
.tree-view-resizer > [data-position="center"] { order: 1; }
.tree-view-resizer > [data-position="bottom"] { order: 2; } Or use a more generic .tree-view-resizer > [data-position="start"] { order: 0; }
.tree-view-resizer > [data-position="center"] { order: 1; }
.tree-view-resizer > [data-position="end"] { order: 2; } Or or or.. 😆 Does it need even steps in between: .tree-view-resizer > [data-position="start"] { order: 0; }
.tree-view-resizer > [data-position="before-center"] { order: 1; }
.tree-view-resizer > [data-position="center"] { order: 2; }
.tree-view-resizer > [data-position="after-center"] { order: 3; }
.tree-view-resizer > [data-position="end"] { order: 4; } Like when you don't really care to be the top item, but you just wanna make sure you're above the tree-view, you could add |
Yes, that's how it works.
I don't really have any preferences between classes and attributes. Maybe attributes are a bit more verbose than classes.
Yeah, sounds more robust, and probably in that case, if we want to use classes then we can use a more generic name like
I think so. As 0 is the default order, you can force to be positionned before an element with order=0 using a negative order but you can't target the space just before the tree-view with only 3 steps. |
Or just I tried to think of a good name for the "in-betweens", but kinda failed. Maybe this: .order--start { order: 0; }
.order--start-center { order: 1; }
.order--center { order: 2; }
.order--center-end { order: 3; }
.order--end { order: 4; } |
This allows other packages to decide where they want to appear no matter the DOM order.
Ok, I pushed this: .tree-view-resizer {
& > .order--start { order: -10; }
& > .order--center { order: 0; }
& > .order--end { order: 10; }
}
|
Looks fine to me 👍 Maybe we could list the packages that append content to the tree-view and notify them of the changes ? |
Added a few to the top. Will try to find some more. So far I think it's ready to be merged since it doesn't totally break any. |
Use a flex layout for the tree-view-resized div
@abe33 These changes are now published. Not sure when it's actually gonna land on stable. |
@simurai Ok, thank you for the help. I'll keep an eye on that and I will prepare tree-view-breadcrumb for the change. |
@olmokramer Noticing the same. Would you mind opening a separate bug report for this? If not, I can do it later. |
Sure: #595 :) |
|
This change does not impact how the tree-view render, but will allow
other packages to insert new content in the
tree-view-resizer
divwithout having to worry about the layout being broken or the list not
scrolling to the last item (as the list can be pushed by the additional
content).
For instance
autohide-tree-view
sets the height using something likecalc(100% - 29px)
which maybe fine if it’s the only package. But itstarts to get ugly when different packages insert content in the
tree-view with different methods (see
abe33/atom-tree-view-breadcrumb#19 for instance).
👎 Broken Packages
tree-view-open-files
But it seems already broken before👋 "Ok, but could be improved" Packages
opened-files
: Still works, but the inline (auto) height could be replaced with flex so that other packages can be added. Auto height paulpflug/opened-files#16tree-view-breadcrumb
: Could use official classes or update theorder
👍 Unaffected Packages
autohide-tree-view
(except the pin could clash with other stuff at the top)Note: The above is only true if each package gets added alone. There are more (sometimes unrelated) issues when enabling multiple packages together.