Tooltips
토큰이 네 개뿐인 컴포넌트, 그리고 같은 질문에 세 번 다르게 답한 리포를 한 번에 닫는 기록
툴팁은 작은 컴포넌트입니다. 그런데 이 리포에는 이미 세 번 구현되어 있고 셋이 서로 다릅니다. 그래서 이 레코드의 첫 일은 값을 적는 게 아니라 어느 답을 택했는지와 그 이유를 적는 것입니다.
아직 프리미티브는 없습니다. 값은 전부
_data/tooltip.yml에서 오고, 그 파일은 토큰 표SOURCE-M3-TOOLTIPS-RAW.md와 M3 산문 네 쪽, 그리고 리포 안의 선례 셋을 출처로 적습니다. 이번 slice는 The plain tooltip only, as a shared primitive the FAB and the icon button both consume. Rich is recorded and not built.
표에는 네 개뿐입니다
살아있는 토큰이 100개인데, plain tooltip 몫은
네 개입니다 — 컨테이너 색 md.sys.color.inverse-surface, 모서리
md.sys.shape.corner.extra-small, 글자 색
md.sys.color.inverse-on-surface, 타입 body-small. 높이도 패딩도 최대 너비도
토큰이 없습니다.
그 수치는 산문에 있습니다 — specs 쪽 속성 표가
“Plain tooltip container height 24dp, padding 8dp.”라고 적습니다. 그래서
레코드는 --md-comp-plain-tooltip-height 같은 것을 만들지 않고 두 수치를 인용과 함께
적습니다. 없는 토큰을 생성하는 순간 이 파일이 아무도 발행하지 않은 값의 출처가 됩니다.
세로 패딩은 산수로 나옵니다: body-small의 줄 높이 16에 위아래 4씩이면
- 검증기가 숫자 셋이 아니라
padding_block_derived * 2 + 16 == container_height를 들고 있어서, 하나가 혼자 움직이면 실패합니다.
rich는 패딩이 비대칭입니다 — 위 12, 아래 8, 좌우
- 이번에 짓지는 않습니다. It is a different component wearing the same name: a surface with a subhead, up to two text buttons, optional links, focus order through them, and a persistent mode that opens on click and survives leaving the target. Nothing in this app asks for one yet.
리포가 자기 자신과 어긋나 있습니다
| 메커니즘 | ARIA | 지연 | |
|---|---|---|---|
| 배포 중인 플러그인 | top layer popover | aria-hidden, role 없음 |
700ms |
| 랩 모듈 | 테마 런타임 | role="tooltip" + aria-describedby |
없음 |
| FAB 안의 span | z-index 2 | aria-hidden |
없음 |
메커니즘은 증거가 고릅니다. 배포 중인 플러그인이 이유까지 적어 뒀습니다 — Its header records the reason: z-index inside a container is not enough, so the popup joins the top layer and can sit above a dialog. This is the same conclusion the menu reached, and it is the mechanism this record adopts.
FAB 안의 span은 replaced로 표시했습니다. It was not in the top layer, so any ancestor with overflow or a stacking context could cut it. The shared Tooltip primitive replaced it with the adopted popover contract; this entry remains as the regression it fixed.
ARIA는 둘 중 하나가 아니라 경우입니다
M3는 “Tooltips should have the Tooltip role, or similar. The tooltip container should have the Tooltip role.”라고 합니다. 랩은 그대로 따랐고, 배포 중인 플러그인은 일부러 반대로 갔습니다. 둘 다 자기 경우에 대해 옳습니다.
The tooltip surface carries role="tooltip" and the trigger points at it with aria-describedby – except where the tooltip’s text is the trigger’s accessible name, where the surface stays aria-hidden and the name is not announced twice.
이유는 중복입니다 — M3 says the container should have the tooltip role, and a description is what a tooltip is. But an icon-only button takes its name from the same words, so pointing at them as a description as well announces them twice – “Compose post, Compose post”. The shipped plugin chose the second half of this rule and wrote the reason down; the lab chose the first. Both are right about their own case, so the rule is which case you are in.
FAB은 어느 쪽인지 먼저 적어 둡니다:
The FAB’s tooltip text is its accessible name, so the FAB is the exception branch: the surface is decorative and aria-label keeps carrying the name.
위치와 동작
plain은 기본이 위, 경계가 있으면 4, 없으면 8입니다 — 버튼처럼 보이는 상자가 있느냐 글자 베이스라인이냐의 차이입니다. app bar 안에서는 아래로 뒤집힙니다.
배치는 Menu의 placer 축을 그대로 씁니다. Flip, shift, clamp against an anchor rectangle is the same problem, and the placer already takes a rectangle rather than an element. A tooltip adds one thing: the gap depends on whether the anchor has a visible boundary, which is a parameter, not a second placer.
동작에서 발행된 수는 사라지는 쪽입니다 — 1500ms. 나타나는 지연은 M3가 적지 않아서 배포 중인 플러그인의 700ms를 가져옵니다. M3 publishes the hide delay and not the show delay. Keeping the plugin’s 700ms means one number in this project rather than two.
그리고 한 번에 하나입니다. 새 툴팁이 뜨면 열려 있던 것이 즉시 닫힙니다. 포커스는 움직이지 않습니다 — Showing a tooltip does not move focus, and a rich tooltip must not trap it. 이것이 popover와 툴팁을 가르는 선이고, 랩의 audit이 “popover 런타임을 복사해 쓸 수 없다”고 결론 낸 이유도 같습니다.
기다리고 있는 소비자
- the FAB, which consumes the accessible-name exception branch
- the icon button, which consumes the exception by default and the descriptive branch when its tooltip differs
extended FAB은 소비자가 아닙니다: The extended FAB. Its label is visible, so M3 says it needs no tooltip, and adding one would be the thing Google Contacts does that this record already flagged as a deviation.