-
Notifications
You must be signed in to change notification settings - Fork 92
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
Fix sidebar layout in compact mode #1338
Conversation
Had to fix an issue, there are just to many different combinations 🙈 |
@@ -597,40 +599,35 @@ $top-buttons-spacing: 6px; | |||
margin: 0 10px; | |||
} | |||
|
|||
&--compact { | |||
&--compact.app-sidebar-header--with-figure { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hum, this seems like a mistake.
I thought you were asking for files, but it's not general, you can have a big one without a figure. 🤔
Otherwise the compact mode should be just a computed like hasFigure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, but if the sidebar has no figure, the compact mode has no effect, right? compact
just makes the figure appear smaller on the left of the title instead of large above it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then it doesn't make sense to add this class anyway, the &--compact
is enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, the compact
css should only be applied if a figure is present. If there is no figure and you apply the compact css, there will be issues, since the star is wrongly aligned then. I will check if the compact mode had an effect without a figure before my changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My point is why complicate the code then? It's unrelated to this pr. We're targetting the compact mode on this css section, this have nothing to do with app-sidebar-header--with-figure
.
Let's not mix template conditions and css structure please :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, the CSS might be slightly simpler, but we would duplicate all other code and markup just for the sake of getting rid of rules for 4 selectors.
Not if you just create Wrapping components. Single slot.
You'd just externalise the css into two components.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean whatever we choose, the whole layout needs to be fixed to what it was before.
What troubles me is that we completely broke something that was working and I can't even grasp the code structure anymore.
I was definitely not planning to spend time on this for the next incoming days/week with the upcoming beta/rc and now server is broken because of this and we released 3 minor versions that now ships a broken AppSidebar. So I'm not super happy about the current situation :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I can imagine that, I am sorry I caused this issue.
To my best knowledge this PR and #1337 fix all layout issues you mentioned, so it should repair the sidebar for server.
Since you didn't name any difference the compact mode makes when the sidebar has no figure, I assume that compact mode without figure
equals normal mode
and created a computed property for this so the --compact
selector is not bound to --figure
anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am sorry I caused this issue.
No need to be sorry! We should have reviewed better! You're not alone collaborating there! 🤗
That's why I used we
and not you
! 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And if the code structure is fucked up in your opinion, we can go back to the state it had with [email protected].
All changes to the appsidebar aren't used at the moment anyway, because I just implemented them for the next release of Tasks. And 2.4.0 is only 5 days old, so probably no one makes use of the changes already.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Main menu in expanded mode is stuck to the right, it shoudl have a
right: right: $top-buttons-spacing;
- The compact mode selector seems bound to the figure, it feels weird
Also, I'll feel honest, the whole css feels like a mess now 🙈
It wasn't perfect before, but now that this was changed with another logic, I fail to understand it (thus was already hard to remember what was in my mind back then 😁 )
How could we improve?
Maybe split the header with two sub-components? One compact one expanded?
Hm, not sure. After all I think both modes are quire similar. As far as I understand it, compact and normal only differ by the figure size/position (#1338 (comment)). Once we have the correct behavior with all modes and options, I can try to clean up the css. At the moment I still struggle to understand what the correct / desired behavior actually is tbh. |
@skjnldsv I cleaned up the sidebar css and structure. To be honest, it feels more clean to me now (but I am for sure biased 🙈). It uses less absolute positioning and relies on I hope that I understood what the sidebar is actually supposed to do. Let me know if something behaves not as it should. |
you should not be able to have both focused at the same time. |
I didn't change anything in that regard. I think it just looks like this, because I hovered the close button. |
Then it's also a regression from the previous pr. This was part of the original specs :) |
Sorry, if I wasn't clear. The menu is currently focused, since I opened and closed it, and the close button is hovered by the mouse. That's why both have a gray background. I think this is how it was before already, but I will double check. |
Aaaah, then it's fine! 😝 |
@skjnldsv Ok, I was wrong. The menu always has a gray background. But it was like that with [email protected] already (before I changed anything): Only in compact mode it has no gray background. Should I remove the gray background? |
Some visual regression testing would be nice here, but it seems quite complicated to set up (at least i didn't really managed to do so, the CSS style wouldn't get applied). |
No this is what I was saying 😛
It's good as it is then. Transparent in compact, grey bg when expanded! 👌 |
Cypress works fine. We could do that with https://github.com/bahmutov/cypress-vue-unit-test |
I will have a look. |
c9f1819
to
c3fbbc0
Compare
@@ -338,6 +342,9 @@ export default { | |||
hasFigureClickListener() { | |||
return this.$listeners['figure-click'] | |||
}, | |||
isCompact() { | |||
return this.hasFigure && this.compact |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, so, sorry about that, but I actually thought about this and I forgot one edge case.
One future addition is to go compact when scrolling down the sidebar. It will be cleaner for super long list like sharing can be.
Thus maybe leaving this to just the compact
prop would be better?
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't mind, we can leave it to the prop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@skjnldsv Given the huge number of valid combinations of props and slots for the component, I am quite afraid that I will break something else when fixing the issues you mentioned. Since #1339 seems to basically work now, I would like to take screenshots of the AppSidebar component for every combination we have before continuing here. We could then identify the combinations with layout issues and make sure that we don't introduce new problems when fixing the issues found. I will try to do so in the evening. |
I'm fine doing this in a follow up yes :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move to just compact
and rebase :)
c3fbbc0
to
3bf89c3
Compare
Signed-off-by: Raimund Schlüßler <[email protected]>
3bf89c3
to
c731c61
Compare
Done. I cannot reproduce the issues you described in #1338 (review) by the way. To me it looks fine. Are you sure you tested the latest state? |
I think I pulled yes, let's get this in and see what comes next :) |
I will work on #1339 in the evening. Hopefully we can then check all different options properly. |
Fixes the sidebar layout in compact mode, implements the second part of #1366:
@skjnldsv Since there are many valid combinations of options (compact, with-star, with-header-figure, with-secondary-actions), it needs a good test to find any possibly remaining issues.