diff --git a/src/devtools/views/Components/Tree.js b/src/devtools/views/Components/Tree.js index 9b60539aef..936c34853e 100644 --- a/src/devtools/views/Components/Tree.js +++ b/src/devtools/views/Components/Tree.js @@ -113,7 +113,7 @@ export default function Tree(props: Props) { ( -
-); +function TreeWrapper({ style, ...rest }) { + const { + numElements, + selectedElementIndex, + selectElementAtIndex, + } = useContext(TreeContext); + + const handleFocus = () => { + if (selectedElementIndex === null && numElements > 0) { + selectElementAtIndex(0); + } + }; + + // This style override enables the background color to fill the full visible width, + // when combined with the CSS tweaks in Element. + // A lot of options were considered; this seemed the one that requires the least code. + // See https://github.com/bvaughn/react-devtools-experimental/issues/9 + return ( +
+ ); +}