Skip to content

ゴミ箱をタップして一括削除する #48 - #49

Merged
temoki merged 1 commit into
mainfrom
feature/48-delete-all
Aug 11, 2026
Merged

ゴミ箱をタップして一括削除する #48#49
temoki merged 1 commit into
mainfrom
feature/48-delete-all

Conversation

@temoki

@temoki temoki commented Aug 11, 2026

Copy link
Copy Markdown
Owner

A 案(缶をタップ → 確認 → ぜんぶ消す)+ macOS メニュー+確認ダイアログ、決めてもらったとおりに実装しました。

入れたもの

  • 缶をタップすると確認 → WorkspaceEditor.deleteAll()。ドロップで 1 枚消す従来の動作はそのまま
  • undo 1 回で完全に戻るsetBlocks([]) の 1 ステップ)。空のときは setBlocks が変化なしを弾くので、空の undo は積まれません
  • macOS: 編集 ▸ ぜんぶけす(⌘⌫)
  • 缶の accessibilityHidden を解除し、ラベル(ぜんぶけす)とヒント(もとにもどせる旨)を付与
  • ja 文字列 6 件

実装中に変えた判断が 1 つ

confirmationDialogalert 最初は confirmationDialog で書きましたが、iPad で撮ってみると缶にぶら下がるポップオーバーになり、タイトルと「やめる」ボタンの両方が落ちます(タップ外しで閉じる形になる)。つまり「ブロックを ぜんぶ けす?」という肝心の問いが画面に出ず、逃げ道だけが唯一表示されないコントロールになる。子ども向けにはどちらも譲れないので alert にしました。

結果:

ブロックを ぜんぶ けす?
もとに もどす ことが できるよ
[ やめる ]  [ ぜんぶけす ]

実装メモ(issue に書いた懸念の答え)

focused value に流すのは WorkspaceUIState(クラス)で、WorkspaceEditor ではありません。後者は Binding を包む値型なので focused value には乗せられない。メニューは確認を要求するだけで、ダイアログの所有と実際の削除はワークスペース側に残しています。おかげで alert は 1 つで済み(2 つ目は 1 つ目を黙って飲み込むため)、缶とメニューの両方が同じ確認を出します。

確認

  • iPad ポートレート: 缶が出ていること、alert がタイトル・メッセージ・2 ボタンで出ることを確認(ダイアログは初期値を一時的に true にして撮影し、撤去済み)
  • swift test 119 tests green / 両ビルド green / swift format lint --strict clean

未確認

実際にタップして消えるところと、macOS のメニュー項目の見え方は私からは操作できないので未確認です。iPad シミュレータに最新ビルドを入れて き.tortoise を開いてあります。缶をタップ →「ぜんぶけす」→ 空状態(みほんの一覧)に戻り、⌘Z で戻ることを見てもらえると受け入れ条件が埋まります。

Fixes #48

Clearing a workspace meant pressing ✕ on every row, and #44 folded that ✕
into a menu — so the fastest way to start over became one menu per block,
which is not a thing a child will do. The can at the bottom already means
"throw this away"; now a drop throws away the block you are holding and a
tap offers to throw away the program. Different gestures, so they never
collide, and the tap asks first.

Being a Button is also what let the can stop being invisible. It had been
accessibilityHidden since #30 because a drop target is nothing a VoiceOver
user can operate; it can now say what it is and what it does.

The confirmation is an alert rather than a confirmationDialog. On iPad the
latter is a popover hanging off the can, and that form drops the title and
the cancel button both — the question never gets asked, and the way out is
the one control not on screen. One alert serves both entry points, since
the second of two would silently swallow the first.

On the Mac it is also Edit ▸ ぜんぶけす (⌘⌫). The menu only asks for the
confirmation: what travels through the focused value is WorkspaceUIState,
not the editor, which is a value type wrapping a Binding and cannot go
that way.

Fixes #48
@temoki

temoki commented Aug 11, 2026

Copy link
Copy Markdown
Owner Author

缶のタップ → 確認 → 全消し、⌘Z での復帰、macOS の 編集 ▸ ぜんぶけす、いずれも @temoki が確認済み。#48 のチェックは全部埋まりました(未チェック 0 件)。

VoiceOver だけは「構造上到達できる」までの確認です(Button 化+ラベル/ヒントで accessibilityHidden を解除)。実際の読み上げを聴く機会があれば、そこで最終確認という扱いにしてあります。

@temoki
temoki merged commit 31ffce4 into main Aug 11, 2026
6 checks passed
@temoki
temoki deleted the feature/48-delete-all branch August 11, 2026 03:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ブロックを一括で消す手段がない(#44 で ✕ 連打の動線が消えた)

1 participant