Project

General

Profile

Actions

Patch #30435

closed

Replace float rules with flexbox for content and sidebar block

Added by Anonymous about 5 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
UI
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:

Description

What this patch does:
1. It moves the sidebar to be rendered after the content block in base.html.erb, since natural flow of HTML should be from left to right, so no point in rendering sidebar before the content block, because it doesn't match our base layout.

2. It sets the #main block to a flexbox and removes a redundant background color definition rule from it.

3. It changes the % based width of the sidebar to a fixed 220px (if you think it should be wider, feedback is welcome), because on wide screens 22% is quite a lot of space!

4. #content block is the only one that will stretch now.


Files

main-block-fixes.diff (2.46 KB) main-block-fixes.diff Anonymous, 2019-01-15 12:41
main-block-fixes-no-swap.diff (1.57 KB) main-block-fixes-no-swap.diff Anonymous, 2019-01-17 07:45
sidebar.png (289 KB) sidebar.png Marius BĂLTEANU, 2019-01-17 21:28
main-block-fixes-no-swap-min-max.diff (1.67 KB) main-block-fixes-no-swap-min-max.diff Anonymous, 2019-02-09 00:34
main-block-fixes-no-swap-min-max_no_shrink.diff (1.68 KB) main-block-fixes-no-swap-min-max_no_shrink.diff Max J.'s patch with flexbox constraints Bernhard Rohloff, 2019-02-14 18:28
30435-screenshot-20190225.png (29.9 KB) 30435-screenshot-20190225.png Go MAEDA, 2019-02-25 07:23
current.png (421 KB) current.png Marius BĂLTEANU, 2019-03-27 23:46
after.png (455 KB) after.png Marius BĂLTEANU, 2019-03-27 23:46
flex_for_content_and_sidebar.patch (1.8 KB) flex_for_content_and_sidebar.patch Marius BĂLTEANU, 2019-03-27 23:50
table-bug@2x.png (79.7 KB) table-bug@2x.png Go MAEDA, 2019-04-28 12:46
responsive-multiresolution-sidebar.patch (1.12 KB) responsive-multiresolution-sidebar.patch Anonymous, 2019-09-04 19:23

Related issues

Related to Redmine - Patch #32037: Constrain sidebar width on different resolutionsClosedGo MAEDA

Actions
Actions #1

Updated by Marius BĂLTEANU about 5 years ago

  • Subject changed from Change #main block to a flexbox + additional minor fixer to it's direct children. to Change #main block to a flexbox + additional minor fixes to it's direct children.
Actions #2

Updated by Go MAEDA about 5 years ago

  • Target version set to 4.1.0

It looks nice. Setting the target version to 4.1.0.

Actions #3

Updated by Marius BĂLTEANU about 5 years ago

Please do not commit because I want to test more these changes. I looked yesterday for few seconds and I saw some problems.

Actions #4

Updated by Marius BĂLTEANU about 5 years ago

  • Assignee set to Marius BĂLTEANU
Actions #5

Updated by Bernhard Rohloff about 5 years ago

The patch looks good to me, although I'm not sure if the width is sufficient for the text length of everbody's saved queries. It also wraps the heading of "Custom queries" if you choose German ( it's "Benutzerdefinierte Abfragen" ) as interface language. No big deal to me but I think it's worth mentioning.

Overall, I think the patch is a great improvement.

+1

Actions #6

Updated by Anonymous about 5 years ago

I'm also wondering about the nature of this rule, does anybody have idea what it should do?

* html #content{ width: 75%; padding-left: 0; margin-top: 0px; padding: 6px 10px 10px 10px;}

because in the default version, just one line above it would already be defined as:

#content{ width: 75%; padding-left: 0; margin-top: 0px; padding: 6px 10px 10px 10px;}

I have a feeling, Internet Explorer is guilty :)

Actions #7

Updated by Marius BĂLTEANU about 5 years ago

In my environment, the #content loads first with 100% width and right after, the sidebar which makes the screen "shakes".

Actions #8

Updated by Anonymous about 5 years ago

Marius BALTEANU wrote:

In my environment, the #content loads first with 100% width and right after, the sidebar which makes the screen "shake".

Marius, I looked into it, so I'm attaching alternative patch without element swapping in base.html.erb to see if this one will not spawn shaking, the previous patch must be reverted before applying this one.

The alternative method could as well be to set #main a flow-direction: row; instead of row-reverse and than add order: 1; for the #content and order: 2; for the #sidebar, but I guess this isn't needed now, because we only have 2 containers, but it could be useful if we re to spawn an additional tile under the sidebar in the future for instance, else in the favor of less rules, it is imho just be simpler to reverse it. :)

Actions #9

Updated by Marius BĂLTEANU about 5 years ago

Thanks Max for updating the patch, it works well with row-reverse.

I agree with Bernhard, the sidebar width (220px) is too small even for small screens, please see the below screenshot from my 13 inch screen:

1. width: 220px;

What do you think if we keep the existing width: 22% rule and we add a max-width of 280px or 300px?

Actions #10

Updated by Anonymous about 5 years ago

I think width: 22% will anyway often exceed it's maximum limitation of max-width, maybe we could try min-width: 220px and max-width: 280px or 300px?
In theory sidebar's content should then expand the sidebar in width within these margins a bit depending on what it contains. :)

Actions #11

Updated by Anonymous about 5 years ago

There is a gridbox design suggestion now pending for further discussion, so this ticket will be affected if we will decide to move #main-menu inside #main container, ultimately making this patch obsolete, because it will then become a 3 tiled gridbox instead of a flexbox. Please see #30451#note-6 for reference.

Actions #12

Updated by Marius BĂLTEANU about 5 years ago

  • Assignee deleted (Marius BĂLTEANU)
Actions #13

Updated by Anonymous about 5 years ago

I think it will be better to ignore #30451 for now, so attaching the patch with min-width and max-width rules for the sidebar, the content of the sidebar will now expand it up to 340px if contains long elements, if there is no need, it will reduce up to 220px. I think it's the most suitable resolution for everyone.
I also removed some redundant rules this time, like:

* html #sidebar{ width: 22%; }
* html #content{ width: 75%; padding-left: 0; margin-top: 0px; padding: 6px 10px 10px 10px;}

Actions #14

Updated by Go MAEDA about 5 years ago

Max Johansson wrote:

I think it will be better to ignore #30451 for now, so attaching the patch with min-width and max-width rules for the sidebar, the content of the sidebar will now expand it up to 340px if contains long elements, if there is no need, it will reduce up to 220px.

Thank you for the patch. Narrower sidebar than the current implementation should be nice for many people.

I tried the patch but I found that the sidebar hardly expands even if there is a custom query with a long name and the width of the browser window is around 1800px. With my Firefox, the width of the sidebar is 261px at 1024px window and 271px at 1800px window.

How can I see a sidebar with a width of 340px?

Actions #15

Updated by Bernhard Rohloff about 5 years ago

Go MAEDA wrote:

I tried the patch but I found that the sidebar hardly expands even if there is a custom query with a long name and the width of the browser window is around 1800px. With my Firefox, the width of the sidebar is 261px at 1024px window and 271px at 1800px window.

How can I see a sidebar with a width of 340px?

I can confirm the behavior you described. I think is an issue with the flexbox constraints.
Here is a modified version of Max's patch which prevents the sidebar from shrinking. Can you check if it's working now?

Actions #16

Updated by Go MAEDA about 5 years ago

I tested main-block-fixes-no-swap-min-max_no_shrink.diff.

When there is a query with a long name, the sidebar became too large even in small screens and the left side of the page is cropped.

Actions #17

Updated by Marius BĂLTEANU about 5 years ago

Go MAEDA wrote:

I tested main-block-fixes-no-swap-min-max_no_shrink.diff.

When there is a query with a long name, the sidebar became too large even in small screens and the left side of the page is cropped.

It is because of the missing width: 22%; rule.

Actions #18

Updated by Bernhard Rohloff about 5 years ago

The patch sets a min-width of 220px and a max-width of 340px for longer query names as it was constrained by Max in #30435#note-13.
By setting the width to 22% again we're loosing space on higher resolutions as the sidebar grows to its max-width even if there's no need to.
It can make a difference up to 120px which can give you an extra column in the issues list or an extra month on the gantt chart.

On the other hand I have to admit that 340px can be too big on small screens (37% @900px). It affects resolutions between 900px and around 1500px.
It just slightly affects the higher resolutions e.g. 1377px so should we consider to set the width only for smaller resolutions? What are your thoughts on this?

Actions #19

Updated by Anonymous about 5 years ago

Bernhard Rohloff wrote:

By setting the width to 22% again we're loosing space on higher resolutions as the sidebar grows to its max-width even if there's no need to.

What I tried to explain in #30435#note-10, but thanks for doing it more clearly. :)

On the other hand I have to admit that 340px can be too big on small screens (37% @900px). It affects resolutions between 900px and around 1500px.
It just slightly affects the higher resolutions e.g. 1377px so should we consider to set the width only for smaller resolutions? What are your thoughts on this?

I propose to either:
1. Create adaptive rules then where we d set max width of the sidebar for different screen sizes/resolutions like so:
Иван Савенко screen and (min-width: 1400px) {#sidebar{max-width:340px;}
Иван Савенко screen and (min-width: 1200px) {#sidebar{max-width:280px;}
Иван Савенко screen and (min-width: 1000px) {#sidebar{max-width:220px;}

I don't have different displays at the moment to test this, perhaps I'll have to do it with setting other lower resolutions of my 1920x1080 native display, I will post an update when tests will be done then and post the patch.

2. Limit the length of the names of custom queries instead and then skip all the adaptive rules.
3. Or move queries away from the sidebar into a more lucky location and again skip all the adaptiveness, because frankly IMHO sidebar isn't the most successful place for the menu objects which allow for ridiculously ultra-long titles.

Actions #20

Updated by Bernhard Rohloff about 5 years ago

Max Johansson wrote:

I propose to either:
1. Create adaptive rules then where we d set max width of the sidebar for different screen sizes/resolutions like so:
Иван Савенко screen and (min-width: 1400px) {#sidebar{max-width:340px;}
Иван Савенко screen and (min-width: 1200px) {#sidebar{max-width:280px;}
Иван Савенко screen and (min-width: 1000px) {#sidebar{max-width:220px;}

I don't have different displays at the moment to test this, perhaps I'll have to do it with setting other lower resolutions of my 1920x1080 native display, I will post an update when tests will be done then and post the patch.

Don't bother with fiddling around in your screen settings. You can test it easily with the builtin dev tools of you browser of choice. Nowadays they all have an option to test multiple screen sizes.
This is IMHO my prefered solution.

2. Limit the length of the names of custom queries instead and then skip all the adaptive rules.

I think this doesn't meet the requirements.

3. Or move queries away from the sidebar into a more lucky location and again skip all the adaptiveness, because frankly IMHO sidebar isn't the most successful place for the menu objects which allow for ridiculously ultra-long titles.

As im not a fan of the sidebar at all this would be my favorite solution. But it requires a lot more effort and discussion so I think this can't be an option for this feature, right now.

Actions #21

Updated by Marius BĂLTEANU about 5 years ago

Let move the discussions about the sidebar width to another ticket and commit the other changes that replace the float rules with flex. In this way, we fix an annoying bug on issue page that reproduces when the sidebar height is greater than the content height.

Current:

With the patch applied:

I'm attaching the patch that I would like to be committed, it contains the work done by Max and a small fix for the sidebar padding.

Actions #22

Updated by Go MAEDA almost 5 years ago

  • Subject changed from Change #main block to a flexbox + additional minor fixes to it's direct children. to Change #main block to a flexbox + additional minor fixes to it's direct children

Marius BALTEANU wrote:

In this way, we fix an annoying bug on issue page that reproduces when the sidebar height is greater than the content height.

Nice. I have been bothered by the bug for years.

Actions #23

Updated by Go MAEDA almost 5 years ago

  • Subject changed from Change #main block to a flexbox + additional minor fixes to it's direct children to Replace float rules with flexbox for content and sidebar block
  • Status changed from New to Closed
  • Assignee set to Go MAEDA

Committed the fix. Thank you for working on this.

Actions #24

Updated by Go MAEDA almost 5 years ago

The change made in r18033 breaks the layout of some pages on medium-sized screens.

To reproduce the problem, open /users page in a 1024px wide browser. The left side of the table is cropped and you cannot see the first name column.

Actions #25

Updated by Marius BĂLTEANU almost 5 years ago

The below patch fixes the problem for me:

diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css
index 09bcd5b..79cf1d0 100644
--- a/public/stylesheets/application.css
+++ b/public/stylesheets/application.css
@@ -92,7 +92,7 @@ pre, code {font-family: Consolas, Menlo, "Liberation Mono", Courier, monospace;}
 #sidebar div.wiki ul {margin:inherit; padding-left:40px;}
 #sidebar div.wiki ul li {list-style-type:inherit;}

-#content { flex-grow: 1; background-color: #fff; margin: 0px; padding: 6px 10px 10px 10px; }
+#content { flex-grow: 1; background-color: #fff; margin: 0px; padding: 6px 10px 10px 10px; overflow-x: auto;}
 html>body #content { min-height: 600px; }
 * html body #content { height: 600px; } /* IE */

Bernhard Ganslmeier, is it ok for you this fix?

Actions #26

Updated by Yuichi HARADA almost 5 years ago

Marius BALTEANU wrote:

The below patch fixes the problem for me:

[...]

Bernhard Ganslmeier, is it ok for you this fix?

Thank you for sharing the patch.
I confirmed that the layout on medium-sized screens( #30435#note-24, /issues and /time_entries pages) does not break by applying your patch.

Actions #27

Updated by Bernhard Rohloff almost 5 years ago

I also tested the fix and it works for me, too.

Actions #28

Updated by Go MAEDA almost 5 years ago

  • Status changed from Reopened to Closed

Committed the fix submitted as #30435#note-25 in r18135. Thank you.

Actions #29

Updated by Anonymous over 4 years ago

To conclude the major point behind this issue, which never got resolved back then, here is a patch to try out as a reference to #30435#note-19

Actions #30

Updated by Go MAEDA over 4 years ago

  • Status changed from Closed to Reopened
Actions #31

Updated by Go MAEDA over 4 years ago

  • Status changed from Reopened to Closed

Antonio McDeal wrote:

To conclude the major point behind this issue, which never got resolved back then, here is a patch to try out as a reference to #30435#note-19

Thank you for posting the patch. I think the width of the sidebar should be discussed in another issue because the topic is really controversial as we experienced in this issue and it will be difficult to close this issue for a long time. In my opinion, I don't like the sidebar width with the patch applied because the width of the sidebar is wider than the current style at 1024px window width (I usually set the browser width to about 1000px - 1100px).

So, I close this issue. If anyone thinks the sidebar width should be improved with the approach suggested by the patch in #30435#note-29, please open a new issue.

Actions #32

Updated by Anonymous over 4 years ago

I created a new issue #32037, please add it as related to this one, because part of important discussion was started in here. :)

Actions #33

Updated by Go MAEDA over 4 years ago

  • Related to Patch #32037: Constrain sidebar width on different resolutions added
Actions

Also available in: Atom PDF