Skip to content

Commit e72c9f4

Browse files
Dhawal RankaDhawal Ranka
authored andcommitted
fix keyboard menu and managed sign-in checks
1 parent 890b4e4 commit e72c9f4

3 files changed

Lines changed: 21 additions & 7 deletions

File tree

mesh/e2e/message-keyboard-actions.spec.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,14 @@ async function installKeyboardActionsMock(page: Page): Promise<void> {
186186
}
187187
case 'matrix_typing_users':
188188
return []
189+
case 'matrix_room_pins':
190+
return {
191+
roomId: String(args.roomId),
192+
eventIds: [],
193+
messages: [],
194+
unavailableEventIds: [],
195+
canManage: true,
196+
}
189197
case 'matrix_mark_read':
190198
case 'matrix_set_typing':
191199
case 'matrix_save_composer_draft':

mesh/e2e/onboarding-accessibility.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ test('@a11y has no automated WCAG A/AA violations on account creation', async ({
3636

3737
test('@a11y has no automated WCAG A/AA violations on sign in', async ({ page }) => {
3838
await page.getByRole('button', { name: 'Sign in', exact: true }).click()
39-
const signInHeading = page.getByRole('heading', { name: 'Sign in somewhere else' })
39+
const signInHeading = page.getByRole('heading', { name: 'Welcome back' })
4040
await expect(signInHeading).toBeVisible()
4141
await waitForAccountScreenMotion(page)
4242
await expect(signInHeading).toBeFocused()

mesh/src/components/chat/Message.tsx

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,13 @@ export const MessageComponent = memo(function MessageComponent({
8888
if (e.key === 'Escape' && showReactions) {
8989
setShowReactions(false)
9090
reactButtonRef.current?.focus()
91+
return
9192
}
93+
if (isQueued || (limitedActions && !isOwnMessage)) return
94+
if (e.key !== 'ContextMenu' && !(e.key === 'F10' && e.shiftKey)) return
95+
e.preventDefault()
96+
setConfirmBan(false)
97+
setContextMenuOpen(true)
9298
}
9399

94100
// Tabbing focus away from the row entirely — e.g. past the last emoji
@@ -230,20 +236,20 @@ export const MessageComponent = memo(function MessageComponent({
230236
if (canPinMessage && !isDeleted) {
231237
contextMenuItems.push({
232238
id: 'pin',
233-
label: isPinned ? 'Unpin Message' : 'Pin Message',
239+
label: isPinned ? 'Unpin message' : 'Pin message',
234240
onSelect: () => void handlePin(),
235241
})
236242
}
237243
if (isOwnMessage && !isDeleted) {
238244
contextMenuItems.push(
239245
{
240246
id: 'edit',
241-
label: 'Edit Message',
247+
label: 'Edit message',
242248
onSelect: handleStartEdit,
243249
},
244250
{
245251
id: 'delete',
246-
label: 'Delete Message',
252+
label: 'Delete message',
247253
tone: 'danger',
248254
onSelect: () => void handleDelete(),
249255
},
@@ -253,19 +259,19 @@ export const MessageComponent = memo(function MessageComponent({
253259
contextMenuItems.push(
254260
{
255261
id: 'remove',
256-
label: 'Remove Message',
262+
label: 'Remove message',
257263
onSelect: () => void handleDelete(),
258264
},
259265
{
260266
id: 'kick',
261-
label: 'Kick User',
267+
label: `Kick ${message.authorDisplayName}`,
262268
onSelect: () => void handleKick(),
263269
},
264270
)
265271
if (!matrixMode) {
266272
contextMenuItems.push({
267273
id: 'timeout',
268-
label: 'Timeout (1hr)',
274+
label: `Timeout ${message.authorDisplayName}`,
269275
onSelect: () => void handleTimeout(),
270276
})
271277
}

0 commit comments

Comments
 (0)