-
Notifications
You must be signed in to change notification settings - Fork 15
docs(spindle-ui): add Tooltip component design doc #1642
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
|
Visit the preview URL for this PR (updated for commit fc2c4a1): https://ameba-spindle--pr1642-docs-tooltip-ypys8osb.web.app (expires Fri, 16 Jan 2026 10:02:14 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: e7521619a2dd5c653490c8246e81ec2a5c8f1435 |
|
reg-suit detected visual differences. Check this report, and review them.
How can I change the check status?If reviewers approve this PR, the reg context status will be green automatically. |
| <button class="spui-IconButton" aria-label="詳細情報" aria-describedby=":r1:" aria-expanded="true"> | ||
| <svg aria-hidden="true"><!-- Information icon --></svg> | ||
| </button> | ||
| <div id=":r1:" class="spui-Tooltip-frame spui-Tooltip-frame--information spui-Tooltip-frame--top spui-Tooltip-frame--center" role="tooltip"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idの名前ってもうちょっとわかりやすくって思ったんですが、
そもそも自動で付与されるということは利用者側はid考慮しなくてもいい感じなんですかね?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reactの useId() で生成する想定です。
利用者側はidを認知する必要はないです。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:naruhodo:
| <svg aria-hidden="true"><!-- Cross icon --></svg> | ||
| </button> | ||
| </div> | ||
| <div class="spui-Tooltip-arrow"></div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
たぶんツールチーっぷのとんがり部分を表現するためのdivだと思うんですけどできれば空divよりかはCSSの擬似要素あたりでできるとよきかもです。
空タグあまり使わない方がいいかと思いまして。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
たしかにです!擬似要素使わずともいけそうだったのでこちらで修正しました:8e9bdc2
| </button> | ||
| <div id=":r1:" class="spui-Tooltip-frame spui-Tooltip-frame--information spui-Tooltip-frame--top spui-Tooltip-frame--center" role="tooltip"> | ||
| <div class="spui-Tooltip-content"> | ||
| <div class="spui-Tooltip-text">ここに補足情報が入ります。</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
いちお質問なんですが文字数って何文字でもいれれる認識であってます?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
何文字でもOKです!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
あまりに長いのは想定していません。
Tooltip内に多くの情報やインタラクションを含めないでください
DO NOTにも一応、長すぎるのは良くない旨入れてます。
tokimari
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WAI-ARIA難しい・・
|
@tokimari #1642 (comment) の件だけデザイナ確認中です。 |
tokimari
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙏
|
Controlled mode(open propあり)とUncontrolled mode(open propなし)の概念を追加し、それぞれに対応するようにしました。(差分大きめです) |
|
Uncontrolled modeでは |
ここまでの議論の自分なりのまとめTooltipで clickとhover/focusを一緒にやろうとしているので、role="tooltip" として一律扱えずにややこしい。 Tooltipは一般にはhover/focusでトリガーされるものTooltipにclickの機能は本来なら持ち込まれるべきではない。 一般に広く使われるTooltipには閉じるボタンがない。というのも、例えばキーボード操作でfocusでトリガーした時にTooltip内の閉じるボタンにアクセスする術がない。 結論:Spindleがやろうとしているのは、TooltipではなくPopoverなのではないか。 |
tokimari
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(施策の方のPRを見る前に前提理解のために覗きました! 🙏 )
概ね良さそうに思いました!! 🎉
細かい点いくつか確認お願いします〜!
| - 初期状態で表示される | ||
| - **初期表示時のみ**閉じるボタンが表示される | ||
| - 一度閉じた後、hover/focusまたはclick/tapで再表示できる | ||
| - **再表示時は閉じるボタンが表示されない**(通常のTooltipと同じ挙動) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment. 実装上複雑になるならこの要件なくても良いかもなとは思いました(実装時に確認)
|
|
|
一旦全て修正完了してます! |
tokimari
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
良さそうな気がします・・!
デザイナーに仕様の再確認はおねがいしたいです 🙌
|
諸々デザイナーとコンセンサス取れました。
|
tokimari
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
あとは良さそうに思いました 🙌
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.

新規で作成するTooltipコンポーネントのDesign Docと実装を追加しました。
意思決定ポイント
コンポーネントの命名
現状ではホバーした際に表示するいわゆる一般的なツールチップは提供せず、クリックした際に表示する形式(トグルチップ形式)のみを提供しますが、将来的にツールチップも提供する可能性があるため、
ToggletipではなくTooltipとしてコンポーネントを設計しています。コンポーネント設計
最終的にパターン3を採用しました。
パターン1: 利用者が手動で管理
Pros:
Cons:
id、triggerRef、aria-describedby、aria-expandedを手動管理パターン2: text propで完全自動化
Pros:
id、aria-*属性などを自動付与Cons:
パターン3: Frame/Trigger/Content
Pros:
id、aria-*属性などを自動付与Cons: