Fix weirdnesses with the spotlight dialog (#7624)
parent
fb49ccce35
commit
ede94e7506
|
@ -124,12 +124,13 @@ const useSpaceResults = (space?: Room, query?: string): [IHierarchyRoom[], boole
|
||||||
const [hierarchy, setHierarchy] = useState<RoomHierarchy>();
|
const [hierarchy, setHierarchy] = useState<RoomHierarchy>();
|
||||||
|
|
||||||
const resetHierarchy = useCallback(() => {
|
const resetHierarchy = useCallback(() => {
|
||||||
const hierarchy = new RoomHierarchy(space, 50);
|
setHierarchy(space ? new RoomHierarchy(space, 50) : null);
|
||||||
setHierarchy(hierarchy);
|
|
||||||
}, [space]);
|
}, [space]);
|
||||||
useEffect(resetHierarchy, [resetHierarchy]);
|
useEffect(resetHierarchy, [resetHierarchy]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (!space || !hierarchy) return; // nothing to load
|
||||||
|
|
||||||
let unmounted = false;
|
let unmounted = false;
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
|
@ -361,7 +362,13 @@ const SpotlightDialog: React.FC<IProps> = ({ initialText = "", onFinished }) =>
|
||||||
let recentSearchesSection: JSX.Element;
|
let recentSearchesSection: JSX.Element;
|
||||||
if (recentSearches.length) {
|
if (recentSearches.length) {
|
||||||
recentSearchesSection = (
|
recentSearchesSection = (
|
||||||
<div className="mx_SpotlightDialog_section mx_SpotlightDialog_recentSearches" role="group">
|
<div
|
||||||
|
className="mx_SpotlightDialog_section mx_SpotlightDialog_recentSearches"
|
||||||
|
role="group"
|
||||||
|
// Firefox sometimes makes this element focusable due to overflow,
|
||||||
|
// so force it out of tab order by default.
|
||||||
|
tabIndex={-1}
|
||||||
|
>
|
||||||
<h4>
|
<h4>
|
||||||
{ _t("Recent searches") }
|
{ _t("Recent searches") }
|
||||||
<AccessibleButton kind="link" onClick={clearRecentSearches}>
|
<AccessibleButton kind="link" onClick={clearRecentSearches}>
|
||||||
|
@ -403,7 +410,7 @@ const SpotlightDialog: React.FC<IProps> = ({ initialText = "", onFinished }) =>
|
||||||
viewRoom(room.roomId);
|
viewRoom(room.roomId);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<DecoratedRoomAvatar room={room} avatarSize={32} />
|
<DecoratedRoomAvatar room={room} avatarSize={32} tooltipProps={{ tabIndex: -1 }} />
|
||||||
{ room.name }
|
{ room.name }
|
||||||
</TooltipOption>
|
</TooltipOption>
|
||||||
))
|
))
|
||||||
|
|
Loading…
Reference in New Issue