Repository navigation
Conversation
Contributor
Author
|
F and jk 操作 UU.mp4 |
Phil-Fan
marked this pull request as draft
November 10, 2026 15:31
Contributor
Author
UU.mp4d/u/gg/G 操作 |
Shift arrives as its own keydown before Shift+A, and treating that modifier press as unknown input closed the whole hint session. Ignore modifier-only and IME keys, resolve label characters case-insensitively (with a physical KeyA-KeyZ fallback), and render badges in the case the user actually types so Shift is never implied. Refs #1054
Library rows carried no hint target, so F filled its 60-slot budget with per-cell copy/tag buttons and skipped most paper names. Mark each row as a priority-1 hint (one badge per visible paper), let an explicit data-hint container own its subtree so nested icon buttons collapse into it, and pick up menuitem/option roles inside floating popups. Floating cards that declare aria-modal="false" no longer become the only scan scope, so hovering a preview keeps the rest of the window hintable. Refs #1054
Hint activation only called element.click(), so Radix / Base UI menus and selects that open on pointerdown (Agent switcher, title-bar settings gear, layout menu) just took focus and never opened. Dispatch the pointer -> mouse -> click sequence a real pointer produces, which keeps click-only triggers working. Refs #1054
Hint mode listens on the window of the document it is mounted in, and only the main window (App.tsx) mounted it. Settings, feature and doc windows are separate webviews, so F did nothing there. Wrap those roots and note the per-window requirement at the root dispatch. Refs #1054
Dropdowns already implement arrow navigation, so j/k re-dispatch ArrowDown/ArrowUp to the focused menu/listbox (Radix menus, selects, context menus) instead of reimplementing focus movement. The file tree had no arrow navigation at all. Add the WAI-ARIA tree behaviour (up/down move focus + selection, right expands or enters the first child, left collapses or steps to the parent) and map j/k/h/l onto it while a tree row is focused. h/l stay inert inside menus. Refs #1054
Phil-Fan
force-pushed
the
feat/1054-e123
branch
from
November 10, 2026 15:42
1f8672e to
e67c33c
Compare
Single-key navigation had no off switch: j/k/h/l moved the file tree and dropdowns unconditionally. Add vimMode (default on) under General → Keyboard as the master switch. It gates list navigation and the PDF Vim keys; the PDF-specific toggle stays but is disabled and explains itself while Vim mode is off. Refs #1054
…ture The pane now renders the element hint switch from AppSettings, so the fixture must provide it; cover the toggle so the setting stays wired.
The viewer now mounts PdfVimKeyHandler, which reads the settings store and EmbedPDF capabilities, so the partial react-i18next and scroll mocks must cover them.
The Vim mode switch snaps back on when the Host binary predates the field: settingsSet drops vimMode, the echoed settings normalise it to the default true. Guard the camelCase round-trip so this cannot regress silently. Refs #1054
The master switch only gated list navigation, and it read a render-time ref, so a cross-window settings:changed could leave the main window running the old value. F stayed on regardless because hint mode had its own switch. Read the settings module cache at keydown time (it is updated synchronously by broadcasts), gate the F hint entry on vimMode too, and close an open hint session when either switch turns off. The Keyboard / PDF sub-switches now disable themselves with a "Requires Vim mode" note while the master is off. Refs #1054
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.


摘要
按 RFC #1054 落地 Navigator 的键盘导航、语义动作与受控决策切片,并吸收 #1038 的 C1/C2 验收要求:
F元素提示。paper/file/pdf-anchor/selection语义目标,复用现有 Command Registry 的动作适配器,执行前重新校验目标与上下文。pdf.selection.intentDecision Gateway,规则优先、System One 兜底,模型只能返回白名单内动作。unavailable,不再按网络错误循环重试,也不阻断本地 PDF 正文解析。Refs #1054、Refs #1038。
类型
场景
键盘归属与输入保护
src/lib/keyboard/ownership.ts与src/lib/pdf/keyboard-ownership.ts统一判断当前键盘归属:最上层 modal、输入框 / 编辑器 / IME composing、PDF 当前 active surface 与 split hover,避免 Hint 和 PDF Vim 键抢走输入。PDF 位移键
j/k/d/u/h/l/J/K/gg/{n}G/n/N,复用现有 PDF 滚动、翻页与搜索能力,不另造滚动实现。PdfVimKeyHandler同时接入 PDF reader 与翻译 PDF reader;gg、{n}G由可单测的 key sequence parser 处理。pdfVimKeys开关,持久化并做默认值归一化。全局 F Hint
HintModeProvider挂载到主窗口、设置窗口与各 popout window root;F只作用于当前 webview/document。data-hint优先,并覆盖 button / tab / menuitem / treeitem / option / link 等通用目标;论文行、文件行、标签页由容器接管子树,优先标出论文名 / 文件名。f保留给进入 / 退出;支持前缀输入、Backspace、Esc,标签输入大小写不敏感,非拉丁布局回退物理KeyA–KeyZ。pointerdown/mousedown/pointerup/mouseup/click,修复 Radix / Base UI 只在pointerdown打开的下拉与菜单。j/k/h/l:打开的下拉映射为上下方向键,聚焦树映射为上下左右;输入框、编辑器与带Shift的组合不生效。语义目标与动作
SemanticTarget使用 discriminated union,区分paper、file、pdf-anchor、selection;UIHintTarget仅限当前窗口、仅存内存,不序列化为语义目标。registerNavigatorAction/executeNavigatorAction复用 Command Registry 中的业务 handler;执行前检查 target 支持、可用性、context fingerprint 与 resource revision,失败返回明确的unsupported-target/unavailable/stale-context/unregistered-action。Decision Gateway
decision_gateway_decideIPC:固定decisionId=pdf.selection.intent、schema version、requestId、target/context identity 与 allowedActionIds。translate/explain/highlight/add-to-agent,模型只能返回其中之一;返回值会再次按白名单过滤。requestPdfSelectionIntent在非 Tauri 环境返回安全空建议。规则型建议
paper:assets-ready与job:completed,生成低敏的内存建议;按workflowId + target + action + resourceRevision去重,带 TTL、冷却、dismiss / snooze 与执行状态。设置与文档
pdfVimKeys、hintModeEnabled设置与键盘设置页开关,en / zh-CN 文案同步。docs/development/rfc-keyboard-navigation-layer.md的落地状态、过滤规则、标签生成和窗口挂载要求;更新docs/backend/paper-import.md的 arXiv 源码不可得语义。验证
pnpm typecheck通过。pnpm vitest run test/keyboard-navigation.test.ts test/file-tree-keyboard.test.ts test/navigator-actions.test.ts test/navigator-suggestions.test.ts test/decision-gateway.test.ts:5 个文件、20 个测试通过。pnpm biome check(本次改动文件)通过。pnpm deps:check通过(本机默认 Node 25 不受 dependency-cruiser 支持,使用 Node 22 运行)。cargo test -p agentero export_typescript_bindings通过,src/lib/core/bindings.ts与 Rust 契约一致。cargo test -p agentero app::events_contract:9 个测试通过。未覆盖:桌面端手动回归与 UI 录屏尚未执行,见下方待补项。
截图(UI / 功能改动必填)
文本对比:
F显示元素标签,输入标签直接激活;PDF 支持 Vim 位移键j/k/h/lFHint截图 / GIF 待补充:当前执行环境没有桌面显示,无法录制。合并前需在
pnpm tauri dev中补「之前 / 之后」截图,并在窄窗口下补一张布局对比。Demo(feat 必填)
10–60 秒演示待补充,建议路径:打开 PDF →
j/k/gg/{n}G→F进入 Hint → 标签打开论文 / 菜单 → 设置中切换开关。自查清单
--no-verify)t()并同步zh-CN