Repository navigation
Conversation
Opening /commands/#<group> (a category link in the docs menu) puts the group's name in the search box and shows only that group. Editing the box is the usual command name search over all groups and drops the hash. Signed-off-by: Madelyn Olson <madelyneolson@gmail.com>
This branch has not been deployed
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.
Clicking a command category in the docs menu now fills the search box with the category name and shows just that category's commands, on /commands/ and from command pages. Editing the box goes back to the normal command name search across all categories and drops the category from the URL. One decision for review: typing a category name by hand stays a name search, so "set" still finds the SET command rather than switching to the Set category. Stacks on valkey-io#773.
AI generated details
Problem
The search box matches command names only (templates/commands.html:95), so filling it with "Hash" would find almost nothing and "Set" would match SET, HSET and CONFIG SET across groups. The page has to know the text came from a category.
Fix
All in templates/commands.html.
.command-groupcarriesdata-group(the groups.json key, same as the heading id) anddata-group-name(its display name), :65.showGroupFromHash(), :115, runs on load and onhashchange. If the hash names a group it puts the display name in the box, shows only that group with all its entries, hides the no-results message, and scrolls the box into view. Onloadit scrolls again, :156, because the browser's own fragment scroll runs after the inline script and puts the heading at the top, hiding the box (measured: box at -69px without it). A hash that names no group does nothing, except an empty hash after a category was active (back button), which clears the filter.oninputinstead ofonkeyup, :15. Keyup also fires for keys that don't edit the box (Tab into it, arrows), which would drop a category filter for no reason; setting.valuefrom script fires neither.onSearchInput(), :143, drops the hash withhistory.replaceStateand dispatches ahashchangeso the menu'smarkCurrent()(from Put the docs menu above the content on phones and add previous/next topic links valkey-io/valkey-io.github.io#773) moves to "All commands".showGroupFromHash()ignores that event because no category is active by then.Alternative considered: matching an exact category name typed by hand. Rejected per the decision above, since "set", "list" and "string" are also command names or substrings people search for.
Screenshots (1440x900)
/commands/#hash, before (valkey-io#773 head):
/commands/#hash, after:
/commands/ after typing "get":
Browser evidence
Headless Chrome over CDP, full command content, Zola 0.23.6. Clicks are
Input.dispatchMouseEventon the menu anchor; typing isInput.dispatchKeyEvent.Load /commands/#hash:
Then click the menu's Sorted Set link:
Then type "get":
From /commands/set/, expand the menu's Command reference and click Hash:
No hash and an unknown hash, valkey-io#773 head against this branch:
Type "set" by hand:
Back button from #sorted-set to #hash to the plain URL:
Try it
Open /commands/ on the preview, click Hash in the menu's Command reference, then Sorted Set, then type in the box.
This was generated by AI but verified, with love, by a human.