Skip to content

Commit e9242f7

Browse files
joshwoodingoliviertassinari
authored andcommitted
[docs] Document Tooltip breaking changes (#15403)
* Add Tooltip breaking changes * Update docs/src/pages/guides/migration-v3/migration-v3.md Co-Authored-By: joshwooding <[email protected]> * Update docs/src/pages/guides/migration-v3/migration-v3.md Co-Authored-By: joshwooding <[email protected]> * Update CHANGELOG.md Co-Authored-By: joshwooding <[email protected]> * Remove space * Update Modal v3 migration guide
1 parent 3044cb4 commit e9242f7

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,22 @@ We hope 2-3 weeks of beta will be enough. We plan on releasing v4 stable in May.
5454
- [DialogActions] Rename the `action` CSS class `spacing`.
5555
- [ExpansionPanelActions] Rename the `action` CSS class `spacing`.
5656

57+
- [Tooltip] Convert to function component (#15291) @joshwooding
58+
The child of the `Tooltip` needs to be able to hold a ref
59+
60+
```diff
61+
class Component extends React.Component {
62+
render() {
63+
return <div />
64+
}
65+
}
66+
-const MyComponent = props => <div {...props} />
67+
+const MyComponent = React.forwardRef((props, ref) => <div ref={ref} {...props} />);
68+
<Tooltip><Component /></Tooltip>
69+
<Tooltip><MyComponent /></Tooltip>
70+
<Tooltip><div /></Tooltip>
71+
```
72+
5773
#### Changes
5874

5975
- [ScrollbarSize] Convert to function component (#15233) @joshwooding

docs/src/pages/guides/migration-v3/migration-v3.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,9 +334,26 @@ You should be able to move the custom styles to the root class key.
334334

335335
### Modal
336336

337-
- [Modal] Ignore event.defaultPrevented (#14991) @oliviertassinari
337+
- [Modal] event.defaultPrevented is now ignored.
338338

339339
The new logic closes the Modal even if `event.preventDefault()` is called on the key down escape event.
340340
`event.preventDefault()` is meant to stop default behaviors like clicking a checkbox to check it, hitting a button to submit a form, and hitting left arrow to move the cursor in a text input etc.
341341
Only special HTML elements have these default behaviors.
342342
People should use `event.stopPropagation()` if they don't want to trigger a `onClose` event on the modal.
343+
344+
### Tooltip
345+
346+
- [Tooltip] The child needs to be able to hold a ref.
347+
348+
```diff
349+
class Component extends React.Component {
350+
render() {
351+
return <div />
352+
}
353+
}
354+
-const MyComponent = props => <div {...props} />
355+
+const MyComponent = React.forwardRef((props, ref) => <div ref={ref} {...props} />);
356+
<Tooltip><Component /></Tooltip>
357+
<Tooltip><MyComponent /></Tooltip>
358+
<Tooltip><div /></Tooltip>
359+
```

0 commit comments

Comments
 (0)