Show a hint for documentation-scoped search - #2713
Open
Vam-si-krish wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a contextual UI hint to help users discover documentation-scoped search (Tab on desktop, Space on mobile) when the current query matches an enabled documentation, and clears that hint when the scope changes or resets.
Changes:
- Adds a search hint element in the header and associates it to the search input via
aria-describedby. - Implements hint discovery/show/hide behavior in
SearchScope, including input padding adjustments to avoid overlap. - Adds a regression test covering hint matching and clearing behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| views/app.erb | Adds the hint DOM element and connects it to the search input via aria-describedby. |
| assets/stylesheets/components/_header.scss | Styles the new hint overlay within the search form. |
| assets/javascripts/views/search/search_scope.js | Adds hint matching/search logic and clears hint on scope/reset. |
| test/assets/search_hash_test.js | Adds regression coverage for hint display and clearing behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+90
to
+91
| this.hint.style.display = "block"; | ||
| this.input.style.paddingRight = this.hint.offsetWidth + 28 + "px"; |
Comment on lines
+32
to
+36
| this.hintSearcher = new app.SynchronousSearcher({ | ||
| fuzzy_min_length: 2, | ||
| max_results: 1, | ||
| }); | ||
| this.hintSearcher.on("results", (results) => this.onHintResults(results)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Testing
bundle exec rake(743 runs, 945 assertions)node --test test/assets/search_hash_test.jsCloses #1517