Skip to content

Commit 11aaa9b

Browse files
refactor: data-tooltip-for -> data-tooltip-id
`data-tooltip-for` ended up sounding weird to me
1 parent 60f287c commit 11aaa9b

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

src/App.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,11 @@ function App() {
114114
</section>
115115
<section id="section-anchor-select" style={{ marginTop: '100px' }}>
116116
<p>
117-
<button data-tooltip-for="anchor-select" data-tooltip-content="this content is different">
117+
<button data-tooltip-id="anchor-select" data-tooltip-content="this content is different">
118118
Anchor select
119119
</button>
120-
<button data-tooltip-for="anchor-select">Anchor select 2</button>
121-
<button data-tooltip-for="anchor-select">Anchor select 3</button>
120+
<button data-tooltip-id="anchor-select">Anchor select 2</button>
121+
<button data-tooltip-id="anchor-select">Anchor select 3</button>
122122
</p>
123123
<Tooltip id="anchor-select">Tooltip content</Tooltip>
124124
<Tooltip

src/components/Tooltip/Tooltip.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ const Tooltip = ({
6060
useEffect(() => {
6161
let selector = anchorSelect
6262
if (!selector && id) {
63-
selector = `[data-tooltip-for='${id}']`
63+
selector = `[data-tooltip-id='${id}']`
6464
}
6565
if (!selector) {
6666
return

src/components/TooltipController/TooltipController.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ const TooltipController = ({
130130

131131
let selector = anchorSelect
132132
if (!selector && id) {
133-
selector = `[data-tooltip-for='${id}']`
133+
selector = `[data-tooltip-id='${id}']`
134134
}
135135
if (selector) {
136136
try {

src/components/TooltipController/TooltipControllerTypes.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export interface ITooltipController {
4646

4747
declare module 'react' {
4848
interface HTMLAttributes<T> extends AriaAttributes, DOMAttributes<T> {
49-
'data-tooltip-for'?: boolean | string
49+
'data-tooltip-id'?: string
5050
'data-tooltip-place'?: PlacesType
5151
'data-tooltip-content'?: string
5252
'data-tooltip-html'?: string

0 commit comments

Comments
 (0)