Commit 4e6929c
committed
[#77] Finally drop use of findDOMNode()
Fixes #77
Fixes #704
For the longest time, since before I took over, we were filtering
specified containers through `ReactDOM.findDOMNode()`, but why?
The configured trap containers (via the `containerElements` prop)
must be elements already, which means they must already be rendered,
which means there's no point in passing them through `findDOMNode()`
to find an underlying DOM element because they aren't React elements
in the first place.
The removal of this call should mean that React Strict Mode will
finally be OK with focus-trap-react.
Note it's still possible to render a focus trap with a single React
element child. That works fine, and never needed `findDOMNode()`
anyway. We were already using a callback ref to get its element
to then auto-configure that element as the single container for
the focus trap.
Just to be sure, however, this will be released as a new __major__
version.1 parent 9947461 commit 4e6929c
3 files changed
Lines changed: 11 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
102 | | - | |
103 | | - | |
| 102 | + | |
| 103 | + | |
104 | 104 | | |
105 | 105 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | 2 | | |
4 | 3 | | |
5 | 4 | | |
6 | 5 | | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | 6 | | |
13 | 7 | | |
14 | 8 | | |
| |||
277 | 271 | | |
278 | 272 | | |
279 | 273 | | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
| 274 | + | |
288 | 275 | | |
289 | 276 | | |
290 | 277 | | |
291 | | - | |
| 278 | + | |
292 | 279 | | |
293 | 280 | | |
294 | 281 | | |
| |||
378 | 365 | | |
379 | 366 | | |
380 | 367 | | |
381 | | - | |
| 368 | + | |
382 | 369 | | |
383 | 370 | | |
384 | 371 | | |
| |||
395 | 382 | | |
396 | 383 | | |
397 | 384 | | |
398 | | - | |
| 385 | + | |
399 | 386 | | |
400 | 387 | | |
401 | 388 | | |
| |||
0 commit comments