Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit a0f5e49

Browse files
committed
Give each room directory entry the listitem role to correspond with the containing list.
Signed-off-by: Nolan Darilek <[email protected]>
1 parent 5c66bd6 commit a0f5e49

File tree

2 files changed

+21
-17
lines changed

2 files changed

+21
-17
lines changed

Diff for: res/css/structures/_RoomDirectory.scss

+7-2
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ limitations under the License.
121121
vertical-align: text-top;
122122
margin-right: 2px;
123123
content: "";
124-
mask: url('$(res)/img/feather-customised/user.svg');
124+
mask: url("$(res)/img/feather-customised/user.svg");
125125
mask-repeat: no-repeat;
126126
mask-position: center;
127127
// scale it down and make the size slightly bigger (16 instead of 14px)
@@ -132,7 +132,8 @@ limitations under the License.
132132
}
133133
}
134134

135-
.mx_RoomDirectory_join, .mx_RoomDirectory_preview {
135+
.mx_RoomDirectory_join,
136+
.mx_RoomDirectory_preview {
136137
align-self: center;
137138
white-space: nowrap;
138139
}
@@ -220,3 +221,7 @@ limitations under the License.
220221
margin-top: 5px;
221222
}
222223
}
224+
225+
.mx_RoomDirectory_listItem {
226+
display: contents;
227+
}

Diff for: src/components/structures/RoomDirectory.tsx

+14-15
Original file line numberDiff line numberDiff line change
@@ -554,20 +554,20 @@ export default class RoomDirectory extends React.Component<IProps, IState> {
554554
if (!hasJoinedRoom && (room.world_readable || isGuest)) {
555555
previewButton = (
556556
<AccessibleButton kind="secondary" onClick={(ev) => this.onPreviewClick(ev, room)}>
557-
{ _t("Preview") }
557+
{_t("Preview")}
558558
</AccessibleButton>
559559
);
560560
}
561561
if (hasJoinedRoom) {
562562
joinOrViewButton = (
563563
<AccessibleButton kind="secondary" onClick={(ev) => this.onViewClick(ev, room)}>
564-
{ _t("View") }
564+
{_t("View")}
565565
</AccessibleButton>
566566
);
567567
} else if (!isGuest) {
568568
joinOrViewButton = (
569569
<AccessibleButton kind="primary" onClick={(ev) => this.onJoinClick(ev, room)}>
570-
{ _t("Join") }
570+
{_t("Join")}
571571
</AccessibleButton>
572572
);
573573
}
@@ -589,9 +589,12 @@ export default class RoomDirectory extends React.Component<IProps, IState> {
589589
if (room.avatar_url) avatarUrl = mediaFromMxc(room.avatar_url).getSquareThumbnailHttp(32);
590590

591591
// We use onMouseDown instead of onClick, so that we can avoid text getting selected
592-
return [
592+
return <div
593+
key={room.room_id}
594+
role="listitem"
595+
className="mx_RoomDirectory_listItem"
596+
>
593597
<div
594-
key={`${room.room_id}_avatar`}
595598
onMouseDown={(ev) => this.onRoomClicked(room, ev)}
596599
className="mx_RoomDirectory_roomAvatar"
597600
>
@@ -603,9 +606,8 @@ export default class RoomDirectory extends React.Component<IProps, IState> {
603606
idName={name}
604607
url={avatarUrl}
605608
/>
606-
</div>,
609+
</div>
607610
<div
608-
key={`${room.room_id}_description`}
609611
onMouseDown={(ev) => this.onRoomClicked(room, ev)}
610612
className="mx_RoomDirectory_roomDescription"
611613
>
@@ -626,30 +628,27 @@ export default class RoomDirectory extends React.Component<IProps, IState> {
626628
>
627629
{ getDisplayAliasForRoom(room) }
628630
</div>
629-
</div>,
631+
</div>
630632
<div
631-
key={`${room.room_id}_memberCount`}
632633
onMouseDown={(ev) => this.onRoomClicked(room, ev)}
633634
className="mx_RoomDirectory_roomMemberCount"
634635
>
635636
{ room.num_joined_members }
636-
</div>,
637+
</div>
637638
<div
638-
key={`${room.room_id}_preview`}
639639
onMouseDown={(ev) => this.onRoomClicked(room, ev)}
640640
// cancel onMouseDown otherwise shift-clicking highlights text
641641
className="mx_RoomDirectory_preview"
642642
>
643643
{ previewButton }
644-
</div>,
644+
</div>
645645
<div
646-
key={`${room.room_id}_join`}
647646
onMouseDown={(ev) => this.onRoomClicked(room, ev)}
648647
className="mx_RoomDirectory_join"
649648
>
650649
{ joinOrViewButton }
651-
</div>,
652-
];
650+
</div>
651+
</div>;
653652
}
654653

655654
private stringLooksLikeId(s: string, fieldType: IFieldType) {

0 commit comments

Comments
 (0)