fix: clear the decorative flag when the upload dialog is handed a different file

The twin of the previous commit, with a sharper consequence. `decorative`
does not merely describe the previous image, it *exempts* it:
`validate-working-copy.ts`'s EVIDENCE_ALT_REQUIRED reads
`Asset.decorative`, so a flag inherited from a discarded divider lets a
meaningful diagram publish with no accessible name at all -- the check
passes rather than catching it. Stale alt text ships a wrong description;
stale `decorative` ships none.

Same terminal-state retry path: tick 장식용 for `divider.png`, have it
rejected, pick `sequence.png`, upload -- and `sequence.png` shipped as
decorative with `altText: undefined`.

Resetting it also re-enables the alt input, so the post-selection focus
call no longer has to ask whether it would land on a disabled control.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
DongHyeonka
2026-08-18 13:23:32 +09:00
co-authored by Claude Opus 5
parent 1f2cba79e9
commit 9950cb9d6b
2 changed files with 85 additions and 1 deletions
@@ -200,9 +200,22 @@ export function AssetUploadDialog(props: Readonly<{
// failure: "which file is this text describing" has one honest
// answer per selection, and `submit()`'s ALT_REQUIRED refusal
// makes the emptied field impossible to ignore.
//
// `decorative` is reset for the same reason and a sharper one.
// It does not merely describe the previous image, it *exempts*
// it: `validate-working-copy.ts`'s EVIDENCE_ALT_REQUIRED reads
// `Asset.decorative`, so a flag inherited from a discarded
// divider lets a meaningful diagram publish with no accessible
// name at all -- the check passes rather than catching it. Alt
// text riding along produces a wrong description; this produces
// none.
setState({ kind: "IDLE" });
setAltText("");
if (!decorative) altRef.current?.focus();
setDecorative(false);
// Unconditional now: the alt field is enabled again by the line
// above, so there is no longer a case where focusing it would
// land on a disabled control.
altRef.current?.focus();
}}
/>
</label>