feat(webui): Focus/refocus query input box for ease of use.#1160
Conversation
WalkthroughThe changes update the query input box to support React refs, enabling programmatic focus control. A ref is created and attached to the input component on the search page. An effect monitors the search UI state and automatically focuses the input when entering specific states, improving usability for user workflows. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant SearchPage
participant QueryInput
participant QueryBox
User->>SearchPage: Navigates to search page
SearchPage->>QueryInput: Renders QueryInput
QueryInput->>QueryBox: Passes inputRef via ref
QueryInput->>QueryBox: Renders QueryBox
QueryInput->>QueryBox: inputRef attached
Note over QueryInput: searchUiState changes to DEFAULT or DONE
QueryInput->>QueryBox: Calls inputRef.current?.focus()
QueryBox->>User: Input is focused
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Assessment against linked issues
Assessment against linked issues: Out-of-scope changesNo out-of-scope changes found. Suggested reviewers
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🧰 Additional context used📓 Path-based instructions (1)**/*.{cpp,hpp,java,js,jsx,tpp,ts,tsx}⚙️ CodeRabbit Configuration File
Files:
🧠 Learnings (4)📓 Common learnings📚 Learning: in components/log-viewer-webui react codebase: return type annotations (like `: jsx.element`) are un...Applied to files:
📚 Learning: in the y-scope/clp react webui client codebase, for zustand store usage: use `usestore.getstate().me...Applied to files:
📚 Learning: in `components/log-viewer-webui/client/src/api/query.js`, the `extractjsonresp` type definition is a...Applied to files:
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (6)
✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
@junhaoliao can you approve this |
junhaoliao
left a comment
There was a problem hiding this comment.
Deferring to @hoophalab ‘s review
Description
PR focuses input box when user enters search page, and when search completes.
Resolves #1068. Not exactly sure what the best way to "return to whatever input the user used before starting the query" mentioned in the issue, so for now it just refocuses on the input when the query completes.
Checklist
breaking change.
Validation performed
Tested it focuses on input on load, and on query success.
Summary by CodeRabbit