From 4501308b47222b4c12eebfc6529eae756c63026f Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 8 Feb 2022 09:17:08 +0000 Subject: [PATCH] Fix instances of decorated room avatar wrongly having their own tabIndex (#7730) --- .../views/rooms/RecentlyViewedButton.tsx | 4 +- .../views/rooms/RoomBreadcrumbs.tsx | 46 +++++++++++-------- 2 files changed, 30 insertions(+), 20 deletions(-) diff --git a/src/components/views/rooms/RecentlyViewedButton.tsx b/src/components/views/rooms/RecentlyViewedButton.tsx index 84d6c91abd1..58b055c4a3d 100644 --- a/src/components/views/rooms/RecentlyViewedButton.tsx +++ b/src/components/views/rooms/RecentlyViewedButton.tsx @@ -21,11 +21,11 @@ import { UPDATE_EVENT } from "../../../stores/AsyncStore"; import { MenuItem } from "../../structures/ContextMenu"; import { useEventEmitterState } from "../../../hooks/useEventEmitter"; import { _t } from "../../../languageHandler"; -import RoomAvatar from "../avatars/RoomAvatar"; import dis from "../../../dispatcher/dispatcher"; import InteractiveTooltip, { Direction } from "../elements/InteractiveTooltip"; import { roomContextDetailsText } from "../../../Rooms"; import { Action } from "../../../dispatcher/actions"; +import DecoratedRoomAvatar from "../avatars/DecoratedRoomAvatar"; const RecentlyViewedButton = () => { const tooltipRef = useRef(); @@ -47,7 +47,7 @@ const RecentlyViewedButton = () => { tooltipRef.current?.hideTooltip(); }} > - +
{ crumb.name }
{ contextDetails &&
diff --git a/src/components/views/rooms/RoomBreadcrumbs.tsx b/src/components/views/rooms/RoomBreadcrumbs.tsx index f3d69b1f284..f4b8e18209b 100644 --- a/src/components/views/rooms/RoomBreadcrumbs.tsx +++ b/src/components/views/rooms/RoomBreadcrumbs.tsx @@ -24,10 +24,11 @@ import { _t } from "../../../languageHandler"; import defaultDispatcher from "../../../dispatcher/dispatcher"; import Analytics from "../../../Analytics"; import { UPDATE_EVENT } from "../../../stores/AsyncStore"; -import { RovingAccessibleTooltipButton } from "../../../accessibility/RovingTabIndex"; +import { useRovingTabIndex } from "../../../accessibility/RovingTabIndex"; import Toolbar from "../../../accessibility/Toolbar"; import { replaceableComponent } from "../../../utils/replaceableComponent"; import { Action } from "../../../dispatcher/actions"; +import AccessibleTooltipButton from "../elements/AccessibleTooltipButton"; interface IProps { } @@ -43,6 +44,31 @@ interface IState { skipFirst: boolean; } +const RoomBreadcrumbTile = ({ room, onClick }: { room: Room, onClick: () => void }) => { + const [onFocus, isActive, ref] = useRovingTabIndex(); + + return ( + + + + ); +}; + @replaceableComponent("views.rooms.RoomBreadcrumbs") export default class RoomBreadcrumbs extends React.PureComponent { private isMounted = true; @@ -87,23 +113,7 @@ export default class RoomBreadcrumbs extends React.PureComponent public render(): React.ReactElement { const tiles = BreadcrumbsStore.instance.rooms.map((r, i) => { - return ( - this.viewRoom(r, i)} - aria-label={_t("Room %(name)s", { name: r.name })} - title={r.name} - tooltipClassName="mx_RoomBreadcrumbs_Tooltip" - > - - - ); + return this.viewRoom(r, i)} />; }); if (tiles.length > 0) {