Skip to content

Commit 4400921

Browse files
committed
bug #24665 Fix dump panel hidden when closing a dump (julienfalque)
This PR was merged into the 2.8 branch. Discussion ---------- Fix dump panel hidden when closing a dump | Q | A | ------------- | --- | Branch? | 2.8 | Bug fix? | yes-ish | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - In the dump panel of the debug bar, when closing a dump the panel sometimes get hidden: ![before](https://user-images.githubusercontent.com/1736542/31867025-615e9c48-b788-11e7-8329-96716c211523.gif) This is because when the size of the panel is reduced, if the mouse is not over it anymore, the `:hover` pseudo-class does not apply anymore. I "fixed" it by setting a min-height on the panel when closing a dump. The min-height is removed when leaving the panel _on purpose_: ![after](https://user-images.githubusercontent.com/1736542/31867054-d01a01cc-b788-11e7-9ef7-8418ae2b3094.gif) For now I only tested it on Firefox 56 on Arch Linux. Commits ------- 2e0b263 Fix dump panel hidden when closing a dump
2 parents 9bc9474 + 2e0b263 commit 4400921

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_js.html.twig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,16 @@
5858
}
5959
};
6060
}
61+
62+
var dumpInfo = document.querySelector('.sf-toolbar-block-dump .sf-toolbar-info');
63+
if (null !== dumpInfo) {
64+
Sfjs.addEventListener(dumpInfo, 'sfbeforedumpcollapse', function () {
65+
dumpInfo.style.minHeight = dumpInfo.getBoundingClientRect().height+'px';
66+
});
67+
Sfjs.addEventListener(dumpInfo, 'mouseleave', function () {
68+
dumpInfo.style.minHeight = '';
69+
});
70+
}
6171
},
6272
function(xhr) {
6373
if (xhr.status !== 0) {

src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,13 @@ function toggle(a, recursive) {
142142
return false;
143143
}
144144
145+
if (doc.createEvent && s.dispatchEvent) {
146+
var event = doc.createEvent('Event');
147+
event.initEvent('sf-dump-expanded' === newClass ? 'sfbeforedumpexpand' : 'sfbeforedumpcollapse', true, false);
148+
149+
s.dispatchEvent(event);
150+
}
151+
145152
a.lastChild.innerHTML = arrow;
146153
s.className = s.className.replace(/\bsf-dump-(compact|expanded)\b/, newClass);
147154

0 commit comments

Comments
 (0)