Repository navigation
Site search: ⌘K / Ctrl+K from any page - #14
Merged
Merged
Conversation
A masthead button and ⌘K (Ctrl+K elsewhere) open a dialog that finds a problem by name, number, pattern or tag and opens its solution page, or LeetCode for one without a page yet. Until now, moving between problems meant going back to the home page. - SiteSearch.astro: a native <dialog> with a combobox field; ↑ ↓ move the active result, Enter opens it, Esc closes and gives focus back. Hidden without JavaScript, where the home page's search box does the job. - /search.json, built from the new src/data/catalog.ts, which the home page now reads too; fetched on first open, so no page carries the list. - the phone masthead's gap drops to 8px so the bar stays one line at 320px - audit: Ctrl+K from a lesson, every lesson listed, "two sum" first, axe clean with the dialog open in both themes, Esc and Enter, one-line bar
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🚀 Deploying Preview to Cloudflare 🚀Preview Deployments by commit
|
The audit's one-line check failed in CI: with a fallback font (before the web fonts load, or on Linux) brand, links, search and theme need 295px of the 292px a 320px screen has. Under 375px the nav's "LeetCode" link, which goes where the brand already does, steps aside; the bar then needs 223px.
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.
Adds a search dialog to every page, opened by a masthead button or ⌘K (Ctrl+K off macOS). It finds a problem by name, number, pattern or tag and opens its solution page, or LeetCode for a problem without a page yet. Until now, moving between problems meant going back to the home page. Nothing else is open, so this is against
main.How it works
<dialog>with a combobox field: focus stays in the field, ↑ ↓ move the active result (wrapping at the ends), Enter opens it, and a click works too. Esc, a backdrop click or ⌘K again closes it, and focus returns to where it was./search.json(11 KB), built from the newsrc/data/catalog.ts, which the home page now reads too. It's fetched the first time the dialog opens, or when the pointer reaches the button, so no page carries the list.Checked
siteSearchcheck that guards the same things.npm run audit: passed, 46 pages.npm run check: 46 lessons, 0 failures.