Skip to content

Commit

Permalink
Only let browser search through source code until it's expanded (#1181)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Earlopain committed Sep 30, 2024
1 parent b7d580a commit 003126c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/rdoc/generator/template/darkfish/css/rdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,9 @@ main header h3 {
/* @group Method Details */

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

main .method-source-code.active-menu {
visibility: visible;
max-height: 100vh;
}

Expand Down

0 comments on commit 003126c

Please sign in to comment.