diff --git a/src/components/structures/LeftPanel.tsx b/src/components/structures/LeftPanel.tsx index c2454e04fb0..084afdaf8ba 100644 --- a/src/components/structures/LeftPanel.tsx +++ b/src/components/structures/LeftPanel.tsx @@ -26,7 +26,6 @@ import { HEADER_HEIGHT } from "../views/rooms/RoomSublist"; import { Action } from "../../dispatcher/actions"; import RoomSearch from "./RoomSearch"; import ResizeNotifier from "../../utils/ResizeNotifier"; -import AccessibleTooltipButton from "../views/elements/AccessibleTooltipButton"; import SpaceStore from "../../stores/spaces/SpaceStore"; import { MetaSpace, SpaceKey, UPDATE_SELECTED_SPACE } from "../../stores/spaces"; import { getKeyBindingsManager } from "../../KeyBindingsManager"; @@ -41,7 +40,7 @@ import RoomBreadcrumbs from "../views/rooms/RoomBreadcrumbs"; import { KeyBindingAction } from "../../accessibility/KeyboardShortcuts"; import { shouldShowComponent } from "../../customisations/helpers/UIComponents"; import { UIComponent } from "../../settings/UIFeature"; -import { ButtonEvent } from "../views/elements/AccessibleButton"; +import AccessibleButton, { ButtonEvent } from "../views/elements/AccessibleButton"; import PosthogTrackers from "../../PosthogTrackers"; import PageType from "../../PageTypes"; import { UserOnboardingButton } from "../views/user-onboarding/UserOnboardingButton"; @@ -333,7 +332,7 @@ export default class LeftPanel extends React.Component { // to start a new call if (LegacyCallHandler.instance.getSupportsPstnProtocol()) { dialPadButton = ( - { let rightButton: JSX.Element | undefined; if (this.state.activeSpace === MetaSpace.Home && shouldShowComponent(UIComponent.ExploreRooms)) { rightButton = ( - = ({ let button: ReactElement; if (busy) { button = ( - = ({ title={_t("space|joining_space")} > - + ); } else if (joinedRoom || room.join_rule === JoinRule.Knock) { // If the room is knockable, show the "View" button even if we are not a member; that @@ -670,25 +667,16 @@ const ManageButtons: React.FC = ({ hierarchy, selected, set const disabled = !selectedRelations.length || removing || saving; - let Button: React.ComponentType> = AccessibleButton; - let props: Partial> = {}; - if (!selectedRelations.length) { - Button = AccessibleTooltipButton; - props = { - tooltip: _t("space|select_room_below"), - alignment: Alignment.Top, - }; - } - let buttonText = _t("common|saving"); if (!saving) { buttonText = selectionAllSuggested ? _t("space|unmark_suggested") : _t("space|mark_suggested"); } + const title = !selectedRelations.length ? _t("space|select_room_below") : undefined; + return ( <> - - + ); }; diff --git a/src/components/structures/SpaceRoomView.tsx b/src/components/structures/SpaceRoomView.tsx index edc857edaf0..a71970c08d3 100644 --- a/src/components/structures/SpaceRoomView.tsx +++ b/src/components/structures/SpaceRoomView.tsx @@ -60,7 +60,6 @@ import { defaultRoomsRenderer, } from "../views/dialogs/AddExistingToSpaceDialog"; import AccessibleButton, { ButtonEvent } from "../views/elements/AccessibleButton"; -import AccessibleTooltipButton from "../views/elements/AccessibleTooltipButton"; import ErrorBoundary from "../views/elements/ErrorBoundary"; import Field from "../views/elements/Field"; import RoomFacePile from "../views/elements/RoomFacePile"; @@ -248,7 +247,7 @@ const SpaceLanding: React.FC<{ space: Room }> = ({ space }) => { let settingsButton; if (shouldShowSpaceSettings(space)) { settingsButton = ( - { showSpaceSettings(space); diff --git a/src/components/views/spaces/QuickSettingsButton.tsx b/src/components/views/spaces/QuickSettingsButton.tsx index 81d1e3dfb88..cf031e4ff16 100644 --- a/src/components/views/spaces/QuickSettingsButton.tsx +++ b/src/components/views/spaces/QuickSettingsButton.tsx @@ -18,7 +18,6 @@ import React from "react"; import classNames from "classnames"; import { _t } from "../../../languageHandler"; -import AccessibleTooltipButton from "../elements/AccessibleTooltipButton"; import ContextMenu, { alwaysAboveRightOf, ChevronFace, useContextMenu } from "../../structures/ContextMenu"; import AccessibleButton from "../elements/AccessibleButton"; import StyledCheckbox from "../elements/StyledCheckbox"; @@ -130,16 +129,16 @@ const QuickSettingsButton: React.FC<{ return ( <> - {!isPanelCollapsed ? _t("common|settings") : null} - + {contextMenu} diff --git a/src/components/views/spaces/SpaceCreateMenu.tsx b/src/components/views/spaces/SpaceCreateMenu.tsx index 2ded20912d2..a690d3494d8 100644 --- a/src/components/views/spaces/SpaceCreateMenu.tsx +++ b/src/components/views/spaces/SpaceCreateMenu.tsx @@ -38,7 +38,6 @@ import { import { logger } from "matrix-js-sdk/src/logger"; import { _t } from "../../../languageHandler"; -import AccessibleTooltipButton from "../elements/AccessibleTooltipButton"; import ContextMenu, { ChevronFace } from "../../structures/ContextMenu"; import createRoom, { IOpts as ICreateOpts } from "../../../createRoom"; import MatrixClientContext, { useMatrixClientContext } from "../../../contexts/MatrixClientContext"; @@ -310,7 +309,7 @@ const SpaceCreateMenu: React.FC<{ } else { body = ( - setVisibility(null)} title={_t("action|go_back")} diff --git a/src/components/views/spaces/SpacePanel.tsx b/src/components/views/spaces/SpacePanel.tsx index 8d3041ff1ed..a9b7093537c 100644 --- a/src/components/views/spaces/SpacePanel.tsx +++ b/src/components/views/spaces/SpacePanel.tsx @@ -34,7 +34,6 @@ import { _t } from "../../../languageHandler"; import { useContextMenu } from "../../structures/ContextMenu"; import SpaceCreateMenu from "./SpaceCreateMenu"; import { SpaceButton, SpaceItem } from "./SpaceTreeLevel"; -import AccessibleTooltipButton from "../elements/AccessibleTooltipButton"; import { useEventEmitter, useEventEmitterState } from "../../../hooks/useEventEmitter"; import SpaceStore from "../../../stores/spaces/SpaceStore"; import { @@ -73,6 +72,7 @@ import { ALTERNATE_KEY_NAME } from "../../../accessibility/KeyboardShortcuts"; import { shouldShowComponent } from "../../../customisations/helpers/UIComponents"; import { UIComponent } from "../../../settings/UIFeature"; import { ThreadsActivityCentre } from "./threads-activity-centre/"; +import AccessibleButton from "../elements/AccessibleButton"; const useSpaces = (): [Room[], MetaSpace[], Room[], SpaceKey] => { const invites = useEventEmitterState(SpaceStore.instance, UPDATE_INVITED_SPACES, () => { @@ -389,24 +389,18 @@ const SpacePanel: React.FC = () => { aria-label={_t("common|spaces")} > - setPanelCollapsed(!isPanelCollapsed)} title={isPanelCollapsed ? _t("action|expand") : _t("action|collapse")} - tooltip={ -
-
- {isPanelCollapsed ? _t("action|expand") : _t("action|collapse")} -
-
- {IS_MAC - ? "⌘ + ⇧ + D" - : _t(ALTERNATE_KEY_NAME[Key.CONTROL]) + - " + " + - _t(ALTERNATE_KEY_NAME[Key.SHIFT]) + - " + D"} -
-
+ // TODO should use a kbd element for accessibility https://developer.mozilla.org/en-US/docs/Web/HTML/Element/kbd + caption={ + IS_MAC + ? "⌘ + ⇧ + D" + : _t(ALTERNATE_KEY_NAME[Key.CONTROL]) + + " + " + + _t(ALTERNATE_KEY_NAME[Key.SHIFT]) + + " + D" } />
diff --git a/src/components/views/spaces/SpaceTreeLevel.tsx b/src/components/views/spaces/SpaceTreeLevel.tsx index d6543300254..253e7bf8816 100644 --- a/src/components/views/spaces/SpaceTreeLevel.tsx +++ b/src/components/views/spaces/SpaceTreeLevel.tsx @@ -45,12 +45,11 @@ import { NotificationLevel } from "../../../stores/notifications/NotificationLev import { getKeyBindingsManager } from "../../../KeyBindingsManager"; import { NotificationState } from "../../../stores/notifications/NotificationState"; import SpaceContextMenu from "../context_menus/SpaceContextMenu"; -import AccessibleTooltipButton from "../elements/AccessibleTooltipButton"; import { useRovingTabIndex } from "../../../accessibility/RovingTabIndex"; import { KeyBindingAction } from "../../../accessibility/KeyboardShortcuts"; type ButtonProps = Omit< - ComponentProps>, + ComponentProps>, "title" | "onClick" | "size" | "element" > & { space?: Room; @@ -143,17 +142,17 @@ export const SpaceButton = ({ const onClick = props.onClick ?? (selected && space ? viewSpaceHome : activateSpace); return ( - ({ {contextMenu} - + ); }; diff --git a/test/components/structures/__snapshots__/SpaceHierarchy-test.tsx.snap b/test/components/structures/__snapshots__/SpaceHierarchy-test.tsx.snap index c8c8c83b67d..89a36905c27 100644 --- a/test/components/structures/__snapshots__/SpaceHierarchy-test.tsx.snap +++ b/test/components/structures/__snapshots__/SpaceHierarchy-test.tsx.snap @@ -32,7 +32,9 @@ exports[`SpaceHierarchy renders 1`] = ` >
renders 1`] = `
should show all activated MetaSpaces in the correct orde
@@ -55,6 +56,7 @@ exports[` should show all activated MetaSpaces in the correct orde
@@ -91,6 +93,7 @@ exports[` should show all activated MetaSpaces in the correct orde
@@ -119,6 +122,7 @@ exports[` should show all activated MetaSpaces in the correct orde
@@ -147,6 +151,7 @@ exports[` should show all activated MetaSpaces in the correct orde
@@ -175,6 +180,7 @@ exports[` should show all activated MetaSpaces in the correct orde
@@ -203,6 +209,7 @@ exports[` should show all activated MetaSpaces in the correct orde
should show all activated MetaSpaces in the correct orde class="mx_ThreadsActivityCentre_container" >