Add tooltips to minimized roomlist2 tiles and sublists
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>pull/21833/head
parent
efd0bd3d00
commit
23fa952905
|
@ -28,7 +28,7 @@ import { ListLayout } from "../../../stores/room-list/ListLayout";
|
||||||
import {
|
import {
|
||||||
ChevronFace,
|
ChevronFace,
|
||||||
ContextMenu,
|
ContextMenu,
|
||||||
ContextMenuButton,
|
ContextMenuTooltipButton,
|
||||||
StyledMenuItemCheckbox,
|
StyledMenuItemCheckbox,
|
||||||
StyledMenuItemRadio,
|
StyledMenuItemRadio,
|
||||||
} from "../../structures/ContextMenu";
|
} from "../../structures/ContextMenu";
|
||||||
|
@ -499,10 +499,10 @@ export default class RoomSublist2 extends React.Component<IProps, IState> {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<ContextMenuButton
|
<ContextMenuTooltipButton
|
||||||
className="mx_RoomSublist2_menuButton"
|
className="mx_RoomSublist2_menuButton"
|
||||||
onClick={this.onOpenMenuClick}
|
onClick={this.onOpenMenuClick}
|
||||||
label={_t("List options")}
|
title={_t("List options")}
|
||||||
isExpanded={!!this.state.contextMenuPosition}
|
isExpanded={!!this.state.contextMenuPosition}
|
||||||
/>
|
/>
|
||||||
{contextMenu}
|
{contextMenu}
|
||||||
|
|
|
@ -29,7 +29,7 @@ import { _t } from "../../../languageHandler";
|
||||||
import {
|
import {
|
||||||
ChevronFace,
|
ChevronFace,
|
||||||
ContextMenu,
|
ContextMenu,
|
||||||
ContextMenuButton,
|
ContextMenuTooltipButton,
|
||||||
MenuItemRadio,
|
MenuItemRadio,
|
||||||
MenuItemCheckbox,
|
MenuItemCheckbox,
|
||||||
MenuItem,
|
MenuItem,
|
||||||
|
@ -54,6 +54,7 @@ import defaultDispatcher from "../../../dispatcher/dispatcher";
|
||||||
import {ActionPayload} from "../../../dispatcher/payloads";
|
import {ActionPayload} from "../../../dispatcher/payloads";
|
||||||
import { RoomNotificationStateStore } from "../../../stores/notifications/RoomNotificationStateStore";
|
import { RoomNotificationStateStore } from "../../../stores/notifications/RoomNotificationStateStore";
|
||||||
import { NotificationState } from "../../../stores/notifications/NotificationState";
|
import { NotificationState } from "../../../stores/notifications/NotificationState";
|
||||||
|
import AccessibleTooltipButton from "../elements/AccessibleTooltipButton";
|
||||||
|
|
||||||
// TODO: Rename on launch: https://github.com/vector-im/riot-web/issues/14367
|
// TODO: Rename on launch: https://github.com/vector-im/riot-web/issues/14367
|
||||||
|
|
||||||
|
@ -373,10 +374,10 @@ export default class RoomTile2 extends React.Component<IProps, IState> {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<ContextMenuButton
|
<ContextMenuTooltipButton
|
||||||
className={classes}
|
className={classes}
|
||||||
onClick={this.onNotificationsMenuOpenClick}
|
onClick={this.onNotificationsMenuOpenClick}
|
||||||
label={_t("Notification options")}
|
title={_t("Notification options")}
|
||||||
isExpanded={!!this.state.notificationsMenuPosition}
|
isExpanded={!!this.state.notificationsMenuPosition}
|
||||||
tabIndex={isActive ? 0 : -1}
|
tabIndex={isActive ? 0 : -1}
|
||||||
/>
|
/>
|
||||||
|
@ -441,10 +442,10 @@ export default class RoomTile2 extends React.Component<IProps, IState> {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<ContextMenuButton
|
<ContextMenuTooltipButton
|
||||||
className="mx_RoomTile2_menuButton"
|
className="mx_RoomTile2_menuButton"
|
||||||
onClick={this.onGeneralMenuOpenClick}
|
onClick={this.onGeneralMenuOpenClick}
|
||||||
label={_t("Room options")}
|
title={_t("Room options")}
|
||||||
isExpanded={!!this.state.generalMenuPosition}
|
isExpanded={!!this.state.generalMenuPosition}
|
||||||
/>
|
/>
|
||||||
{contextMenu}
|
{contextMenu}
|
||||||
|
@ -537,11 +538,16 @@ export default class RoomTile2 extends React.Component<IProps, IState> {
|
||||||
ariaDescribedBy = messagePreviewId(this.props.room.roomId);
|
ariaDescribedBy = messagePreviewId(this.props.room.roomId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let Button: React.ComponentType<React.ComponentProps<typeof AccessibleButton>> = AccessibleButton;
|
||||||
|
if (this.props.isMinimized) {
|
||||||
|
Button = AccessibleTooltipButton;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<RovingTabIndexWrapper inputRef={this.roomTileRef}>
|
<RovingTabIndexWrapper inputRef={this.roomTileRef}>
|
||||||
{({onFocus, isActive, ref}) =>
|
{({onFocus, isActive, ref}) =>
|
||||||
<AccessibleButton
|
<Button
|
||||||
onFocus={onFocus}
|
onFocus={onFocus}
|
||||||
tabIndex={isActive ? 0 : -1}
|
tabIndex={isActive ? 0 : -1}
|
||||||
inputRef={ref}
|
inputRef={ref}
|
||||||
|
@ -554,13 +560,14 @@ export default class RoomTile2 extends React.Component<IProps, IState> {
|
||||||
aria-label={ariaLabel}
|
aria-label={ariaLabel}
|
||||||
aria-selected={this.state.selected}
|
aria-selected={this.state.selected}
|
||||||
aria-describedby={ariaDescribedBy}
|
aria-describedby={ariaDescribedBy}
|
||||||
|
title={this.props.isMinimized ? name : undefined}
|
||||||
>
|
>
|
||||||
{roomAvatar}
|
{roomAvatar}
|
||||||
{nameContainer}
|
{nameContainer}
|
||||||
{badge}
|
{badge}
|
||||||
{this.renderGeneralMenu()}
|
{this.renderGeneralMenu()}
|
||||||
{this.renderNotificationsMenu(isActive)}
|
{this.renderNotificationsMenu(isActive)}
|
||||||
</AccessibleButton>
|
</Button>
|
||||||
}
|
}
|
||||||
</RovingTabIndexWrapper>
|
</RovingTabIndexWrapper>
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
|
|
|
@ -16,7 +16,11 @@ limitations under the License.
|
||||||
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import classNames from "classnames";
|
import classNames from "classnames";
|
||||||
import { RovingTabIndexWrapper } from "../../../accessibility/RovingTabIndex";
|
import {
|
||||||
|
RovingAccessibleButton,
|
||||||
|
RovingAccessibleTooltipButton,
|
||||||
|
RovingTabIndexWrapper
|
||||||
|
} from "../../../accessibility/RovingTabIndex";
|
||||||
import AccessibleButton from "../../views/elements/AccessibleButton";
|
import AccessibleButton from "../../views/elements/AccessibleButton";
|
||||||
import NotificationBadge from "./NotificationBadge";
|
import NotificationBadge from "./NotificationBadge";
|
||||||
import { NotificationState } from "../../../stores/notifications/NotificationState";
|
import { NotificationState } from "../../../stores/notifications/NotificationState";
|
||||||
|
@ -86,19 +90,20 @@ export default class TemporaryTile extends React.Component<IProps, IState> {
|
||||||
);
|
);
|
||||||
if (this.props.isMinimized) nameContainer = null;
|
if (this.props.isMinimized) nameContainer = null;
|
||||||
|
|
||||||
|
let Button = RovingAccessibleButton;
|
||||||
|
if (this.props.isMinimized) {
|
||||||
|
Button = RovingAccessibleTooltipButton;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<RovingTabIndexWrapper>
|
<Button
|
||||||
{({onFocus, isActive, ref}) =>
|
|
||||||
<AccessibleButton
|
|
||||||
onFocus={onFocus}
|
|
||||||
tabIndex={isActive ? 0 : -1}
|
|
||||||
inputRef={ref}
|
|
||||||
className={classes}
|
className={classes}
|
||||||
onMouseEnter={this.onTileMouseEnter}
|
onMouseEnter={this.onTileMouseEnter}
|
||||||
onMouseLeave={this.onTileMouseLeave}
|
onMouseLeave={this.onTileMouseLeave}
|
||||||
onClick={this.props.onClick}
|
onClick={this.props.onClick}
|
||||||
role="treeitem"
|
role="treeitem"
|
||||||
|
title={this.props.isMinimized ? name : undefined}
|
||||||
>
|
>
|
||||||
<div className="mx_RoomTile2_avatarContainer">
|
<div className="mx_RoomTile2_avatarContainer">
|
||||||
{this.props.avatar}
|
{this.props.avatar}
|
||||||
|
@ -107,9 +112,7 @@ export default class TemporaryTile extends React.Component<IProps, IState> {
|
||||||
<div className="mx_RoomTile2_badgeContainer">
|
<div className="mx_RoomTile2_badgeContainer">
|
||||||
{badge}
|
{badge}
|
||||||
</div>
|
</div>
|
||||||
</AccessibleButton>
|
</Button>
|
||||||
}
|
|
||||||
</RovingTabIndexWrapper>
|
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue