Repository navigation
fix(ui): style 属性を止める CSP の下でもネイティブ入力と Skeleton が崩れないようにする - #31
Merged
Merged
Conversation
- Checkbox・Radio・Switch の隣のネイティブ入力を hide-native-input でクラスからも隠す - Skeleton の既定の大きさをクラスで持ち、指定が無いときは style 属性を出さない - ルールブック 04 に「CSP の下で使う」を追加(Base UI が出す style、ハッシュでの許し方、eval を使わない検証ライブラリ) bouzu(tkc310/bouzu#78・#82・#84)での知見を反映。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S5dPLGGVzZyRz8dob3cTmz
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S5dPLGGVzZyRz8dob3cTmz
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by tkc310 · project thread
変更内容
bouzu(tkc310/bouzu#78・#82・#84)は公開に向けて
style-srcに'unsafe-inline'を入れない CSP を掛けており、そこで見つかった問題を 8341-ui の側で直します。なぜ: サーバーで描画した HTML の
style属性は、この CSP で止まります。Base UI は Checkbox・Radio・Switch の隣にネイティブ入力(aria-hidden)を描き、style 属性で見えなくしているため、止まると入力が見えてしまいます。Skeleton もwidth/heightを必ず style 属性で出していたので、既定の大きさでも崩れます。hide-native-inputを足し、Checkbox / Radio のラベル(choiceVariants)と Switch のラベルに付けた。display:noneにはせず、フォームへ送る入力として残すwidth/heightを指定しないときは style 属性を出さない。props の型と振る舞いは変えていない'unsafe-hashes'と値ごとのハッシュで許す方法、Zod 4 の JIT がnew Functionを試して違反が報告される件(Valibot など eval を使わない検証ライブラリを勧める)Storybook プレビュー
なし(CSP の無い Storybook では見た目は変わりません)
完了の定義
make checkとmake testが通る.changeset/csp-friendly.md、patch)改善ループ
docs/improvement/log.mdに 1 行追記したGenerated by Claude Code