Commit 35a4e33
committed
fix[devtools/tree/element]: onClick -> onMouseDown to handle first click correctly (#28486)
There is a weird behaviour in all shells of RDT: when user opens
`Components` tab and scrolls down a tree (without any prior click or
focus event), and then clicks on some element, the `click` event will
not be fired. Because `click` event hasn't been fired, the `focus` event
is fired for the whole list and we pre-select the first (root) element
in the tree:
https://github.com/facebook/react/blob/034130c02ffb47b0026059b57d17e9b080976ff3/packages/react-devtools-shared/src/devtools/views/Components/Tree.js#L217-L226
Check the demo (before) what is happening. I don't know exactly why
`click` event is not fired there, but it only happens:
1. For elements, which were not previously rendered (for virtualization
purposes).
2. When HTML-element (div), which represents the container for the tree
was not focused previously.
Unlike the `click` event, the `mousedown` event is fired consistently.
### Before
https://github.com/facebook/react/assets/28902667/9f3ad75d-55d0-4c99-b2d0-ead63a120ea0
### After
https://github.com/facebook/react/assets/28902667/e34816be-644c-444c-8e32-562a79494e44
Tested that it works in all shells, including the select / deselect
features (with `metaKey` param in event).
DiffTrain build for commit facebook/react@aa4eae6.1 parent ed524df commit 35a4e33
7 files changed
Lines changed: 9 additions & 9 deletions
File tree
- compiled-rn/facebook-fbsource/xplat/js
- RKJSModules/vendor
- react-test-renderer/cjs
- react/cjs
- react-native-github/Libraries/Renderer
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25733 | 25733 | | |
25734 | 25734 | | |
25735 | 25735 | | |
25736 | | - | |
| 25736 | + | |
25737 | 25737 | | |
25738 | 25738 | | |
25739 | 25739 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9173 | 9173 | | |
9174 | 9174 | | |
9175 | 9175 | | |
9176 | | - | |
| 9176 | + | |
9177 | 9177 | | |
9178 | 9178 | | |
9179 | 9179 | | |
| |||
9204 | 9204 | | |
9205 | 9205 | | |
9206 | 9206 | | |
9207 | | - | |
| 9207 | + | |
9208 | 9208 | | |
9209 | 9209 | | |
9210 | 9210 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9601 | 9601 | | |
9602 | 9602 | | |
9603 | 9603 | | |
9604 | | - | |
| 9604 | + | |
9605 | 9605 | | |
9606 | 9606 | | |
9607 | 9607 | | |
| |||
9632 | 9632 | | |
9633 | 9633 | | |
9634 | 9634 | | |
9635 | | - | |
| 9635 | + | |
9636 | 9636 | | |
9637 | 9637 | | |
9638 | 9638 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
598 | 598 | | |
599 | 599 | | |
600 | 600 | | |
601 | | - | |
| 601 | + | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
594 | 594 | | |
595 | 595 | | |
596 | 596 | | |
597 | | - | |
| 597 | + | |
598 | 598 | | |
599 | 599 | | |
600 | 600 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
0 commit comments