Skip to content

Commit 003126c

Browse files
authored
Only let browser search through source code until it's expanded (#1181)
Something that's been bothering me is that while the source code is not visible by default, the browser still jump to it when searching. Adding the `visible` property prevents this. Test it out yourself: * `bundle exec rdoc` * open `_site/index.html` * Search for `NameError` Before, you will get a match from `load_yaml` source code, after you only get the match when that methods source code is expanded.
1 parent b7d580a commit 003126c

File tree

1 file changed

+4
-0
lines changed
  • lib/rdoc/generator/template/darkfish/css

1 file changed

+4
-0
lines changed

lib/rdoc/generator/template/darkfish/css/rdoc.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,9 @@ main header h3 {
585585
/* @group Method Details */
586586

587587
main .method-source-code {
588+
/* While this is already invisible through the rule below, this will inform the browser to
589+
not consider source code during text searching until it is actually expanded. */
590+
visibility: hidden;
588591
max-height: 0;
589592
overflow: auto;
590593
transition-duration: 200ms;
@@ -594,6 +597,7 @@ main .method-source-code {
594597
}
595598

596599
main .method-source-code.active-menu {
600+
visibility: visible;
597601
max-height: 100vh;
598602
}
599603

0 commit comments

Comments
 (0)