From a0f5e49c1d87b3fd9ef0121033ca276999a9c677 Mon Sep 17 00:00:00 2001 From: Nolan Darilek Date: Tue, 26 Oct 2021 03:53:31 -0500 Subject: [PATCH] Give each room directory entry the `listitem` role to correspond with the containing `list`. Signed-off-by: Nolan Darilek --- res/css/structures/_RoomDirectory.scss | 9 +++++-- src/components/structures/RoomDirectory.tsx | 29 ++++++++++----------- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/res/css/structures/_RoomDirectory.scss b/res/css/structures/_RoomDirectory.scss index b6219da9e46a..0137db7ebf26 100644 --- a/res/css/structures/_RoomDirectory.scss +++ b/res/css/structures/_RoomDirectory.scss @@ -121,7 +121,7 @@ limitations under the License. vertical-align: text-top; margin-right: 2px; content: ""; - mask: url('$(res)/img/feather-customised/user.svg'); + mask: url("$(res)/img/feather-customised/user.svg"); mask-repeat: no-repeat; mask-position: center; // scale it down and make the size slightly bigger (16 instead of 14px) @@ -132,7 +132,8 @@ limitations under the License. } } -.mx_RoomDirectory_join, .mx_RoomDirectory_preview { +.mx_RoomDirectory_join, +.mx_RoomDirectory_preview { align-self: center; white-space: nowrap; } @@ -220,3 +221,7 @@ limitations under the License. margin-top: 5px; } } + +.mx_RoomDirectory_listItem { + display: contents; +} diff --git a/src/components/structures/RoomDirectory.tsx b/src/components/structures/RoomDirectory.tsx index 56e6b2dfb811..13b827746a7f 100644 --- a/src/components/structures/RoomDirectory.tsx +++ b/src/components/structures/RoomDirectory.tsx @@ -554,20 +554,20 @@ export default class RoomDirectory extends React.Component { if (!hasJoinedRoom && (room.world_readable || isGuest)) { previewButton = ( this.onPreviewClick(ev, room)}> - { _t("Preview") } + {_t("Preview")} ); } if (hasJoinedRoom) { joinOrViewButton = ( this.onViewClick(ev, room)}> - { _t("View") } + {_t("View")} ); } else if (!isGuest) { joinOrViewButton = ( this.onJoinClick(ev, room)}> - { _t("Join") } + {_t("Join")} ); } @@ -589,9 +589,12 @@ export default class RoomDirectory extends React.Component { if (room.avatar_url) avatarUrl = mediaFromMxc(room.avatar_url).getSquareThumbnailHttp(32); // We use onMouseDown instead of onClick, so that we can avoid text getting selected - return [ + return
this.onRoomClicked(room, ev)} className="mx_RoomDirectory_roomAvatar" > @@ -603,9 +606,8 @@ export default class RoomDirectory extends React.Component { idName={name} url={avatarUrl} /> -
, +
this.onRoomClicked(room, ev)} className="mx_RoomDirectory_roomDescription" > @@ -626,30 +628,27 @@ export default class RoomDirectory extends React.Component { > { getDisplayAliasForRoom(room) }
- , +
this.onRoomClicked(room, ev)} className="mx_RoomDirectory_roomMemberCount" > { room.num_joined_members } -
, +
this.onRoomClicked(room, ev)} // cancel onMouseDown otherwise shift-clicking highlights text className="mx_RoomDirectory_preview" > { previewButton } -
, +
this.onRoomClicked(room, ev)} className="mx_RoomDirectory_join" > { joinOrViewButton } -
, - ]; + + ; } private stringLooksLikeId(s: string, fieldType: IFieldType) {