fix(Tooltip): 접근성(a11y) 개선 및 스타일 코드 개선#245
Conversation
🦋 Changeset detectedLatest commit: 4154442 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review (2)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
3o14
left a comment
There was a problem hiding this comment.
고생하셨습니다! 테스트 코드만 논의된 대로 영어로 통일되면 좋을 것 같습니다 👍🏻
영어로 변경했습니다! |
|
@Yeom-JinHo |
| } | ||
|
|
||
| interface CalculateTooltipPositionParams { | ||
| export interface CalculateTooltipPositionParams { |
There was a problem hiding this comment.
타입 정리하다가 잘못수정된거 같아요. 제거하였습니다!
@minji0214 changeset 한번 돌려주세요~ |
반영하였습니다! |
G-hoon
left a comment
There was a problem hiding this comment.
@minji0214 님,
일단 Approve 해드리는데,
이거 Tooltip 컴포넌트 전반적으로 수정이 필요할 것 같아요...
- useTooltip.tsx -> useTooltip.ts 로 되어야 할 것 같고.
- handlePosition은 매 이벤트마다 DOM rect를 읽고 state를 업데이트합니다. scroll/resize는 매우 빈번하게 scroll 및 resize 가 매 렌더마다 발생하는데, requestAnimationFrame 혹은 쓰로틀링 걸어야 할 것 같아요
- 아래 코드에서, createPortal 된 순간 isVisible 값이 항상 true 인데, 아래 className 속성 isVisible 값이 있을 필요가 없을 것 같아요.
createPortal(
<div
ref={tooltipRef}
className={clsx(styles.tooltip({ placement: placementProp }), tooltipClassName, isVisible && 'visible')}
style={
| | 'bottom-right' | ||
| | 'left' | ||
| | 'right'; | ||
| export const TooltipPosition = { |
| export type TooltipPosition = (typeof TooltipPosition)[keyof typeof TooltipPosition]; | ||
|
|
||
| export type TooltipTrigger = 'hover' | 'click'; | ||
| export const TooltipTrigger = { |
There was a problem hiding this comment.
기존에 trigger 방식이 hover, click 을 명시적으로 정해서 사용하는 패턴으로 구현이 되어있었네요.
SIDE 디자인 시스템에 요구사항이 명확히 없었어서 아마 임의로 작업을 했던거같습니다.
저도 의아해서 조금 찾아보니까
- https://base-ui.com/react/components/tooltip
- https://www.radix-ui.com/primitives/docs/components/tooltip
- https://ark-ui.com/docs/components/tooltip#examples
trigger 방식을 명시적으로 정해놓지는 않고 click과 hover는 항상 이벤트는 받고있는거 같고, 필요하면 Controlled(제어) 할 수 있도록 boolean을 넘겨주는 패턴이 좀 있는거 같아요.
일단 지금 문제점은 trigger 방식을 hover로 해놨을때, tab을 통해서 keyboard focus하게되면 툴팁이 안나오는거 같습니다. 이거는 지원해주는게 옳을거 같은데 어떻게 생각하시나요?
|
|
||
| export type TooltipTrigger = 'hover' | 'click'; | ||
| export const TooltipTrigger = { | ||
| hover: 'hover', |
There was a problem hiding this comment.
저도 다른거 찾아보다가 알게된거인데, hover했을때 나오는 Tooltip Content에 마우스가 이동했을때 Unmount되면 안된다고 해요
Screen.Recording.2026-04-23.at.00.15.25.mov
https://www.w3.org/WAI/WCAG22/Understanding/content-on-hover-or-focus.html
Changes
Visuals
as-is
2026-04-19.10.18.00.mov
to-be
2026-04-19.10.21.54.mov
Checklist
Additional Discussion Points
현재 테스트 코드가 컴포넌트마다 한글/영어로 혼재되어 있어요. 어느 언어로 통일하면 좋을지 한번 같이 이야기해보면 좋을 것 같습니다! 🙂(논의완)