Improved channel focus
parent
5cf7730b7a
commit
0dd62df664
|
@ -25,7 +25,9 @@ const ContainerView = (props: { tree: RDPChannelTree, events: Registry<ChannelTr
|
||||||
let target = event.target as HTMLElement;
|
let target = event.target as HTMLElement;
|
||||||
while(target !== refContainer.current && target) { target = target.parentElement; }
|
while(target !== refContainer.current && target) { target = target.parentElement; }
|
||||||
|
|
||||||
focusWithin.current = !!target;
|
if(focusWithin.current) {
|
||||||
|
refContainer.current?.focus();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let keyListener;
|
let keyListener;
|
||||||
|
@ -55,7 +57,13 @@ const ContainerView = (props: { tree: RDPChannelTree, events: Registry<ChannelTr
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={viewStyle.treeContainer} ref={refContainer}>
|
<div
|
||||||
|
className={viewStyle.treeContainer}
|
||||||
|
ref={refContainer}
|
||||||
|
onBlur={() => focusWithin.current = false}
|
||||||
|
onFocus={() => focusWithin.current = true}
|
||||||
|
tabIndex={1}
|
||||||
|
>
|
||||||
<ChannelTreeView events={props.events} dataProvider={props.tree} ref={props.tree.refTree} />
|
<ChannelTreeView events={props.events} dataProvider={props.tree} ref={props.tree.refTree} />
|
||||||
<PopoutButton tree={props.tree} ref={props.tree.refPopoutButton} />
|
<PopoutButton tree={props.tree} ref={props.tree.refPopoutButton} />
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue