Add tooltip to collapsed sublists

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2020-07-17 18:54:09 +01:00
parent 38dc3c8bd1
commit 8ea806b43e

View File

@ -561,6 +561,11 @@ export default class RoomSublist2 extends React.Component<IProps, IState> {
</div> </div>
); );
let Button = AccessibleButton;
if (this.props.isMinimized) {
Button = AccessibleTooltipButton;
}
// Note: the addRoomButton conditionally gets moved around // Note: the addRoomButton conditionally gets moved around
// the DOM depending on whether or not the list is minimized. // the DOM depending on whether or not the list is minimized.
// If we're minimized, we want it below the header so it // If we're minimized, we want it below the header so it
@ -569,7 +574,7 @@ export default class RoomSublist2 extends React.Component<IProps, IState> {
return ( return (
<div className={classes} onKeyDown={this.onHeaderKeyDown} onFocus={onFocus} aria-label={this.props.label}> <div className={classes} onKeyDown={this.onHeaderKeyDown} onFocus={onFocus} aria-label={this.props.label}>
<div className="mx_RoomSublist2_stickable"> <div className="mx_RoomSublist2_stickable">
<AccessibleButton <Button
onFocus={onFocus} onFocus={onFocus}
inputRef={ref} inputRef={ref}
tabIndex={tabIndex} tabIndex={tabIndex}
@ -579,10 +584,11 @@ export default class RoomSublist2 extends React.Component<IProps, IState> {
aria-level={1} aria-level={1}
onClick={this.onHeaderClick} onClick={this.onHeaderClick}
onContextMenu={this.onContextMenu} onContextMenu={this.onContextMenu}
title={this.props.isMinimized ? this.props.label : undefined}
> >
<span className={collapseClasses} /> <span className={collapseClasses} />
<span>{this.props.label}</span> <span>{this.props.label}</span>
</AccessibleButton> </Button>
{this.renderMenu()} {this.renderMenu()}
{this.props.isMinimized ? null : badgeContainer} {this.props.isMinimized ? null : badgeContainer}
{this.props.isMinimized ? null : addRoomButton} {this.props.isMinimized ? null : addRoomButton}