Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7db3e25

Browse files
bug #29984 [VarDumper] Fixed search bar (ro0NL)
This PR was squashed before being merged into the 4.2 branch (closes #29984). Discussion ---------- [VarDumper] Fixed search bar | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no <!-- see https://symfony.com/bc --> | Deprecations? | no | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | #... <!-- #-prefixed issue number(s), if any --> | License | MIT | Doc PR | symfony/symfony-docs#... <!-- required for new features --> Continuation of #28854, replaces #29176 initial: ![image](https://user-images.githubusercontent.com/1047696/51747953-3c9e1400-20ab-11e9-913d-d60bd59ee2d9.png) ctrl f: ![image](https://user-images.githubusercontent.com/1047696/51747973-4b84c680-20ab-11e9-8d07-e6128822fbb2.png) scroll: ![image](https://user-images.githubusercontent.com/1047696/51747984-550e2e80-20ab-11e9-8b54-b24109d2280a.png) tested in chrome+ff cc @ogizanagi ref https://caniuse.com/#feat=css-sticky Commits ------- 99d2893 [VarDumper] Fixed search bar
2 parents 0f94713 + 99d2893 commit 7db3e25

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)