Keep focus when typing in full-page filter forms that auto-submit

未关闭
#2,823 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
42/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
rails, ruby
领域
frontend, testing

调研方向

Read the “Lazy index/filter frames” section in CLAUDE.md and the reference implementation in #2815; this issue is explicitly blocked on that pull request merging. Then update the six listed filter views and add a system spec for each page that types through the auto-submit; done means the final input value and URL are preserved.

由索引模型根据 Issue 内容生成。

描述

blocked

🤖 From Claude:

Typing in a filter box on these pages reloads the whole page after a short pause, so the cursor leaves the box and any further typing is lost.

Why it happens

  • The collection Stimulus controller auto-submits text fields 400 ms after typing stops.
  • On these pages the filter form isn't inside a results Turbo Frame, so each submit is a full-page visit that drops focus.

Affected pages (frameless filter forms using collection, with text filters)

  • app/views/quotes/_search_boxes.html.erb
  • app/views/faqs/_search_boxes.html.erb
  • app/views/story_ideas/_search_boxes.html.erb
  • app/views/workshop_variation_ideas/_search_boxes.html.erb
  • app/views/forms/results.html.erb
  • app/views/bookmarks/tally.html.erb

Fix (already used on workshop logs in #2815)

  • turbo_refreshes_with method: :morph, scroll: :preserve in the page view.
  • data: { turbo_action: "replace" } on the filter form.
  • data-turbo-permanent plus an id on any TomSelect wrapper so the morph doesn't strip its widget.
  • System spec per page: type, pause long enough to submit, keep typing, and assert the final value + URL.
  • Pattern documented in CLAUDE.md → "Lazy index/filter frames".

Blocked on

  • #2815 merging (it introduces the pattern and the reference implementation).
主要语言
Ruby
星标
15
派生
28
平均合并
16 小时 38 分钟
30 天内合并 PR
298

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

rubyforgood/awbw 的其他 Issue

查看 rubyforgood/awbw 的全部 Issue

相似的 Issue

更多 Ruby Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。