Skip to content

Commit 0209901

Browse files
committed
bug #19786 Update profiler's layout to use flexbox (javiereguiluz)
This PR was squashed before being merged into the 2.8 branch (closes #19786). Discussion ---------- Update profiler's layout to use flexbox | Q | A | ------------- | --- | Branch? | 2.8 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - ### Problem The layout of the profiler uses some old CSS tricks to make the sidebar look like a same-height sidebar (`margin-bottom: -99999px;` and `padding-bottom: 99999px;`, a large `min-height` in the content, etc.) This works most of the time ... but there are some edge cases where the sidebar looks ugly (it doesn't have the same height as the main content). ### Solution This proposal updates the profiler layout to use CSS flexbox. * It looks and behaves exactly like before ... but it also fixes all the edge cases. * flexbox has ~90% of global browser support --> so it should be 100% of Symfony developers --- ~~Sadly **there is one issue that I cannot solve**:~~ ~~* The "Performance" panel doesn't work on Chrome and Firefox (but it works on Safari!!)~~ ~~* The problem is that the `getContainerWidth()` function in `time.html.twig` template doesn't return the right value and the generated canvas has a wrong width.~~ ~~Any clues?~~ It's fixed now! Commits ------- d986ac0 Update profiler's layout to use flexbox
2 parents 23bc357 + d986ac0 commit 0209901

File tree

1 file changed

+34
-20
lines changed

1 file changed

+34
-20
lines changed

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/profiler.css.twig

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,15 @@ html{font-family:sans-serif;-webkit-text-size-adjust:100%;-ms-text-size-adjust:1
1717

1818
{# Basic styles
1919
========================================================================= #}
20+
html, body {
21+
height: 100%;
22+
width: 100%;
23+
}
2024
body {
2125
background-color: #F9F9F9;
2226
color: #222;
27+
display: flex;
28+
flex-direction: column;
2329
{{ mixins.sans_serif_font|raw }}
2430
font-size: 14px;
2531
line-height: 1.4;
@@ -401,16 +407,34 @@ tr.status-warning td {
401407
max-width: 1300px;
402408
padding-right: 15px;
403409
}
410+
#header {
411+
flex: 0 0 auto;
412+
}
413+
#header .container {
414+
display: flex;
415+
flex-direction: row;
416+
justify-content: space-between;
417+
}
418+
#summary {
419+
flex: 0 0 auto;
420+
}
404421
#content {
405-
min-height: 1024px;
406-
overflow: hidden;
422+
height: 100%;
423+
}
424+
#main {
425+
display: flex;
426+
flex-direction: row-reverse;
427+
min-height: 100%;
428+
}
429+
#sidebar {
430+
flex: 0 0 220px;
407431
}
408432
#collector-wrapper {
409-
float: left;
410-
width: 100%;
433+
flex: 0 1 100%;
434+
min-width: 0;
411435
}
412436
#collector-content {
413-
margin: 0 0 30px 220px;
437+
margin: 0 0 30px 0;
414438
padding: 14px 0 14px 20px;
415439
}
416440

@@ -428,7 +452,6 @@ tr.status-warning td {
428452
color: #FFF;
429453
font-weight: normal;
430454
font-size: 21px;
431-
float: left;
432455
margin: 0;
433456
padding: 10px 10px 8px;
434457
}
@@ -445,7 +468,6 @@ tr.status-warning td {
445468
fill: #FFF;
446469
}
447470
#header .search {
448-
float: right;
449471
padding-top: 11px;
450472
}
451473
#header .search input {
@@ -511,10 +533,7 @@ tr.status-warning td {
511533
#sidebar {
512534
background: #444;
513535
color: #CCC;
514-
float: left;
515-
margin-bottom: -99999px; {# needed for 'same-height columns' trick #}
516-
margin-left: -100%;
517-
padding-bottom: 99999px; {# needed for 'same-height columns' trick #}
536+
padding-bottom: 30px;
518537
position: relative;
519538
width: 220px;
520539
z-index: 9999;
@@ -597,7 +616,6 @@ tr.status-warning td {
597616
#menu-profiler li {
598617
position: relative;
599618
margin-bottom: 0;
600-
width: 220px;
601619
}
602620
#menu-profiler li a {
603621
border: solid transparent;
@@ -922,17 +940,13 @@ table.logs .sf-call-stack abbr {
922940
}
923941

924942
@media (max-width: 768px) {
925-
#collector-content {
926-
margin-left: 50px;
927-
}
928-
929943
#sidebar {
930-
width: 50px;
931-
overflow-y: hidden;
932-
transition: width 200ms ease-out;
944+
flex-basis: 50px;
945+
overflow-x: hidden;
946+
transition: flex-basis 200ms ease-out;
933947
}
934948
#sidebar:hover, #sidebar.expanded {
935-
width: 220px;
949+
flex-basis: 220px;
936950
}
937951

938952
#sidebar-search {

0 commit comments

Comments
 (0)