Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Stop the JSON formatter's Find bar from typing into the JSON

已关闭 适合新手
#121 2 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 1 天内回复

@kudala-bharani 已经在做这个了。

开始于 2026年10月19日。

  • #209 来自 @kudala-bharani —— 未关闭

评估

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

调研方向

从 app/(tools)/json-formatter/components/FindBar.tsx 第 34 到 36 行的 effect 开始,它会在匹配项变化时调用 onScrollTo。然后阅读 app/(tools)/json-formatter/JsonFormatterClient.tsx 中的 findScrollTo(第 309 到 318 行),其中编辑器的 textarea 获得焦点,并且选区被设置为零长度。完成标准是:输入 email 这类多字符查询时,焦点保留在查找框中,JSON 内容保持不变,匹配项被高亮;Enter、Shift+Enter、方向按钮、Escape、计数器和大小写切换的行为都符合验收标准。使用 npm run lint、npm run test 和 npm run build 进行检查。

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

描述

bug hacktoberfest help wanted

In the JSON formatter, typing in the Find bar jumps into the JSON editor after the first character, so the rest of your search ends up typed into the document.

Steps to reproduce

  1. Load the example JSON and press Cmd/Ctrl+F.
  2. Type email.
  3. After the e, the caret moves into the editor and mail is inserted into the JSON.

Expected: focus stays in the Find box, the JSON doesn't change, and the match is highlighted. The match isn't highlighted today either, because the selection is set to zero length (pos to pos + 0).

The cause: FindBar calls onScrollTo in an effect every time the matches change, and findScrollTo calls el.focus() on the textarea.

Where to look

  • app/(tools)/json-formatter/components/FindBar.tsx (the effect at lines 34 to 36)
  • app/(tools)/json-formatter/JsonFormatterClient.tsx (findScrollTo, lines 311 to 320)

Acceptance criteria

  • Typing a multi-character query keeps focus in the Find box and leaves the JSON untouched
  • Enter, Shift+Enter and the arrow buttons move between matches and select the whole match
  • Escape closes the bar and puts focus back in the editor
  • The match counter and the case toggle still work
  • npm run lint, npm run test and npm run build pass

Want to work on this? Comment below and I'll assign it to you. Please take one issue at a time, branch off develop, and open your PR against develop with Closes #121 in the description.

主要语言
TypeScript
星标
1
派生
9
平均合并
9 小时 9 分钟
30 天内合并 PR
118

环境准备

从这里开始

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

codercops/toolbelt 的其他 Issue

查看 codercops/toolbelt 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

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