Skip to content

Commit

Permalink
feature #32429 [VarDumper] Let browsers trigger their own search on d…
Browse files Browse the repository at this point in the history
…ouble CMD/CTRL + F (ogizanagi)

This PR was merged into the 4.4 branch.

Discussion
----------

[VarDumper] Let browsers trigger their own search on double CMD/CTRL + F

| Q             | A
| ------------- | ---
| Branch?       | 4.4 <!-- see below -->
| Bug fix?      | no
| New feature?  | yes <!-- please update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | #29748   <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | N/A

Simple way to enhance DX & mitigate #29748

Commits
-------

d243058 [VarDumper] Let browsers trigger their own search on double CMD/CTRL + F hit
  • Loading branch information
fabpot committed Jul 8, 2019
2 parents d9aace2 + d243058 commit 29654a4
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php
Expand Up @@ -588,6 +588,15 @@ function showCurrent(state)
var isSearchActive = !/\bsf-dump-search-hidden\b/.test(search.className);
if ((114 === e.keyCode && !isSearchActive) || (isCtrlKey(e) && 70 === e.keyCode)) {
/* F3 or CMD/CTRL + F */
if (70 === e.keyCode && document.activeElement === searchInput) {
/*
* If CMD/CTRL + F is hit while having focus on search input,
* the user probably meant to trigger browser search instead.
* Let the browser execute its behavior:
*/
return;
}
e.preventDefault();
search.className = search.className.replace(/\bsf-dump-search-hidden\b/, '');
searchInput.focus();
Expand Down

0 comments on commit 29654a4

Please sign in to comment.