Skip to content

FOLLOW-UP: Wire keyboard-shortcuts search input as a real command palette demo (from PR #74) #78

@adnaan

Description

@adnaan

Context

This follow-up task was identified during the review of PR #74.

Source PR: #74
PR Title: feat: patterns example Session 4 (patterns #17-21) — dialogs, tabs & navigation
Suggested by: @claude[bot] (PR comments, rounds 1, 5, 9, 10)

Task Description

The Keyboard Shortcuts pattern's command panel currently shows a disabled <input type="search"> as a visual stub:

{{/* Decorative — wiring to a Change()/Submit() handler is out of scope ... disabled removes the false affordance ... */}}
<input type="search" placeholder="Type a command…" disabled aria-label="Command search">

A more pedagogically complete pattern would actually wire the input — e.g., a Change() handler that filters a list of commands as the user types, or a Submit() handler that logs the typed query into the activity log.

Why Not in PR #74

PR #74 scoped pattern #21 narrowly to "global keyboard event binding via lvt-on:window:keydown". The full command-palette experience (search filter, command execution) would expand the pattern's scope substantially.

Suggested Implementation

Option A: Filter-as-you-type

  • Add Commands []string to ShortcutsState
  • Add Filter string to track the search query
  • Wire the input with lvt-form:debounce-300 and a Change(state, ctx) handler that updates Filter and re-filters Commands

Option B: Search-and-log

  • Wrap the input in a <form method="POST">
  • Add a Search(state, ctx) handler that pushes the query into state.Log like the existing Open/Close events

Either would give learners adapting this pattern a more complete reference.


Auto-created by prmonitor from PR review comments.

Metadata

Metadata

Assignees

No one assigned

    Labels

    follow-upFollow-up task from PR reviewfrom-reviewIssue originated from PR review

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions