mirror of https://github.com/vector-im/riot-web
Space panel fix aria-expanded being set to false on nodes without children
parent
25fb243d0b
commit
40f9302ec9
|
@ -270,8 +270,10 @@ export class SpaceItem extends React.PureComponent<IItemProps, IItemState> {
|
||||||
? StaticNotificationState.forSymbol("!", NotificationColor.Red)
|
? StaticNotificationState.forSymbol("!", NotificationColor.Red)
|
||||||
: SpaceStore.instance.getNotificationState(space.roomId);
|
: SpaceStore.instance.getNotificationState(space.roomId);
|
||||||
|
|
||||||
|
const hasChildren = this.state.childSpaces?.length;
|
||||||
|
|
||||||
let childItems;
|
let childItems;
|
||||||
if (this.state.childSpaces?.length && !collapsed) {
|
if (hasChildren && !collapsed) {
|
||||||
childItems = <SpaceTreeLevel
|
childItems = <SpaceTreeLevel
|
||||||
spaces={this.state.childSpaces}
|
spaces={this.state.childSpaces}
|
||||||
activeSpaces={activeSpaces}
|
activeSpaces={activeSpaces}
|
||||||
|
@ -280,7 +282,7 @@ export class SpaceItem extends React.PureComponent<IItemProps, IItemState> {
|
||||||
/>;
|
/>;
|
||||||
}
|
}
|
||||||
|
|
||||||
const toggleCollapseButton = this.state.childSpaces?.length ?
|
const toggleCollapseButton = hasChildren ?
|
||||||
<AccessibleButton
|
<AccessibleButton
|
||||||
className="mx_SpaceButton_toggleCollapse"
|
className="mx_SpaceButton_toggleCollapse"
|
||||||
onClick={this.toggleCollapse}
|
onClick={this.toggleCollapse}
|
||||||
|
@ -289,7 +291,13 @@ export class SpaceItem extends React.PureComponent<IItemProps, IItemState> {
|
||||||
/> : null;
|
/> : null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<li {...otherProps} className={itemClasses} ref={innerRef} aria-expanded={!collapsed} role="treeitem">
|
<li
|
||||||
|
{...otherProps}
|
||||||
|
className={itemClasses}
|
||||||
|
ref={innerRef}
|
||||||
|
aria-expanded={hasChildren ? !collapsed : undefined}
|
||||||
|
role="treeitem"
|
||||||
|
>
|
||||||
<SpaceButton
|
<SpaceButton
|
||||||
space={space}
|
space={space}
|
||||||
className={isInvite ? "mx_SpaceButton_invite" : undefined}
|
className={isInvite ? "mx_SpaceButton_invite" : undefined}
|
||||||
|
|
Loading…
Reference in New Issue