8000 [VarDumper] Fixed search bar · symfony/symfony@99d2893 · GitHub
[go: up one dir, main page]

Skip to content

Commit 99d2893

Browse files
ro0NLnicolas-grekas
authored andcommitted
[VarDumper] Fixed search bar
1 parent 0f94713 commit 99d2893

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

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

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -500,12 +500,17 @@ function xpathHasClass(className) {
500500
501501
function showCurrent(state)
502502
{
503-
var currentNode = state.current();
503+
var currentNode = state.current(), currentRect, searchRect;
504504
if (currentNode) {
505505
reveal(currentNode);
506506
highlight(root, currentNode, state.nodes);
507507
if ('scrollIntoView' in currentNode) {
508-
currentNode.scrollIntoView();
508+
currentNode.scrollIntoView(true);
509+
currentRect = currentNode.getBoundingClientRect();
510+
searchRect = search.getBoundingClientRect();
511+
if (currentRect.top < (searchRect.top + searchRect.height)) {
512+
window.scrollBy(0, -(searchRect.top + searchRect.height + 5));
513+
}
509514
}
510515
}
511516
counter.textContent = (state.isEmpty() ? 0 : state.idx + 1) + ' of ' + state.count();
@@ -641,6 +646,7 @@ function showCurrent(state)
641646
display: block;
642647
white-space: pre;
643648
padding: 5px;
649+
overflow: initial !important;
644650
}
645651
pre.sf-dump:after {
646652
content: "";
@@ -709,14 +715,16 @@ function showCurrent(state)
709715
border-radius: 3px;
710716
}
711717
pre.sf-dump .sf-dump-search-hidden {
712-
display: none;
718+
display: none !important;
713719
}
714720
pre.sf-dump .sf-dump-search-wrapper {
715-
float: right;
716721
font-size: 0;
717722
white-space: nowrap;
718-
max-width: 100%;
719-
text-align: right;
723+
margin-bottom: 5px;
724+
display: flex;
725+
position: -webkit-sticky;
726+
position: sticky;
727+
top: 5px;
720728
}
721729
pre.sf-dump .sf-dump-search-wrapper > * {
722730
vertical-align: top;
@@ -733,10 +741,11 @@ function showCurrent(state)
733741
height: 21px;
734742
font-size: 12px;
735743
border-right: none;
736-
width: 140px;
737744
border-top-left-radius: 3px;
738745
border-bottom-left-radius: 3px;
739746
color: #000;
747+
min-width: 15px;
748+
width: 100%;
740749
}
741750
pre.sf-dump .sf-dump-search-wrapper > .sf-dump-search-input-next,
742751
pre.sf-dump .sf-dump-search-wrapper > .sf-dump-search-input-previous {

0 commit comments

Comments
 (0)
0