Skip to content

ClearButton / CopyButton に type="button" 追加(form 内 submit 暴発回避) #258

Description

@fumtas1k

背景

#256 (B 案 PR 1) の final code review で発覚(pre-existing 課題)。

src/components/ui/ClearButton.tsx / src/components/ui/CopyButton.tsx<button>type="button" 属性が無い。

課題

これらのボタンが <form> 要素内で使用された場合、HTML 仕様で type 属性なしの <button> はデフォルト type="submit" として扱われ、クリックで意図せず form submit を発動させる可能性がある。

ActionButton.tsx は明示的に type="button" を持っており(line 40)、整合性も確保されない。

対応

両ファイルの <button> 要素に type="button" を追加。

// ClearButton.tsx
<button type="button" onClick={onClick} className="...">

// CopyButton.tsx (compact 分岐 + 通常分岐の両方)
<button type="button" onClick={handleClick} aria-label={label} className="...">

関連

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions