✨ feat(dialog): add search dialog functionality with input handling - #412
Conversation
twisti-dev
commented
Aug 19, 2026
- introduce SearchDialog for querying with customizable input fields
- implement action buttons for search and cancel with tooltips
- ensure dialog closes before executing callbacks for search and close actions
- introduce SearchDialog for querying with customizable input fields - implement action buttons for search and cancel with tooltips - ensure dialog closes before executing callbacks for search and close actions
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e84132d332
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| type { | ||
| confirmation { | ||
| no { |
There was a problem hiding this comment.
Bind cancellation to the no button
When canCloseWithEscape is enabled, confirmation-dialog cancellation delegates to the no button, but this block assigns onSearch to that button and onClose to yes. Pressing Escape therefore submits the current query and invokes onSearch instead of treating the dismissal as cancellation; swap the search and cancel button mappings.
Useful? React with 👍 / 👎.
| val search = SearchDialogAction( | ||
| label = { }, | ||
| tooltip = { } |
There was a problem hiding this comment.
Preserve defaults when customizing button blocks
When a caller supplies either button block to customize only one property—for example, changing the cancel tooltip—the corresponding default-argument block is not executed, and these empty initializers erase the default label and tooltip. The resulting button can therefore have a blank label; initialize each SearchDialogAction with its documented default values before applying the caller's block, as is already done for SearchInput.
Useful? React with 👍 / 👎.
| tooltip(search.tooltip) | ||
|
|
||
| action { | ||
| customPlayerClick { response, player -> |
There was a problem hiding this comment.
Allow returned dialogs to handle repeated submissions
When the returned Dialog is cached, revisited from a dialog list, or shown to multiple players, each button stops working after its first use because customPlayerClick defaults to DialogCallbackOptions.DEFAULT, whose registration permits only one global use. Since searchDialog neither exposes callback options nor documents the returned dialog as single-use, subsequent clicks are silently ignored; register reusable callbacks or expose lifecycle options to callers.
Useful? React with 👍 / 👎.