mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-24 09:28:21 +08:00
Use ref from hook
This commit is contained in:
parent
6e5f593c98
commit
5c3a518576
@ -73,7 +73,7 @@ export const SpaceButton = <T extends keyof JSX.IntrinsicElements>({
|
|||||||
...props
|
...props
|
||||||
}: ButtonProps<T>): JSX.Element => {
|
}: ButtonProps<T>): JSX.Element => {
|
||||||
const [menuDisplayed, handle, openMenu, closeMenu] = useContextMenu<HTMLElement>(innerRef);
|
const [menuDisplayed, handle, openMenu, closeMenu] = useContextMenu<HTMLElement>(innerRef);
|
||||||
const [onFocus, isActive] = useRovingTabIndex(handle);
|
const [onFocus, isActive, ref] = useRovingTabIndex(handle);
|
||||||
const tabIndex = isActive ? 0 : -1;
|
const tabIndex = isActive ? 0 : -1;
|
||||||
|
|
||||||
const spaceKey = _spaceKey ?? space?.roomId;
|
const spaceKey = _spaceKey ?? space?.roomId;
|
||||||
@ -144,7 +144,7 @@ export const SpaceButton = <T extends keyof JSX.IntrinsicElements>({
|
|||||||
title={!isNarrow || menuDisplayed ? undefined : label}
|
title={!isNarrow || menuDisplayed ? undefined : label}
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
onContextMenu={openMenu}
|
onContextMenu={openMenu}
|
||||||
ref={handle}
|
ref={ref}
|
||||||
tabIndex={tabIndex}
|
tabIndex={tabIndex}
|
||||||
onFocus={onFocus}
|
onFocus={onFocus}
|
||||||
>
|
>
|
||||||
|
Loading…
Reference in New Issue
Block a user