-
Notifications
You must be signed in to change notification settings - Fork 11.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat:
ReadReceiptIndicator
a11y improvement (#32317)
Co-authored-by: Tiago Evangelista Pinto <[email protected]>
- Loading branch information
1 parent
fb6d9eb
commit b01cdce
Showing
11 changed files
with
93 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@rocket.chat/meteor': minor | ||
--- | ||
|
||
Replace the read receipt receipt indicator in order to improve the accessibility complience |
24 changes: 19 additions & 5 deletions
24
apps/meteor/client/components/message/ReadReceiptIndicator.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,29 @@ | ||
import type { IMessage } from '@rocket.chat/core-typings'; | ||
import { Box, Icon } from '@rocket.chat/fuselage'; | ||
import { useTranslation } from '@rocket.chat/ui-contexts'; | ||
import type { ReactElement } from 'react'; | ||
import React from 'react'; | ||
|
||
type ReadReceiptIndicatorProps = { | ||
mid: IMessage['_id']; | ||
unread?: boolean; | ||
}; | ||
|
||
const ReadReceiptIndicator = ({ unread }: ReadReceiptIndicatorProps): ReactElement | null => ( | ||
<Box position='absolute' insetBlockStart={2} insetInlineEnd={8}> | ||
<Icon name='check' size='x16' color={unread ? 'annotation' : 'info'} /> | ||
</Box> | ||
); | ||
const ReadReceiptIndicator = ({ mid, unread }: ReadReceiptIndicatorProps): ReactElement | null => { | ||
const t = useTranslation(); | ||
|
||
return ( | ||
<Box | ||
role='status' | ||
id={`${mid}-read-status`} | ||
aria-label={unread ? t('Message_sent') : t('Message_viewed')} | ||
position='absolute' | ||
insetBlockStart={2} | ||
insetInlineEnd={8} | ||
> | ||
<Icon size='x16' name={unread ? 'check' : 'double-check'} color={unread ? 'annotation' : 'info'} /> | ||
</Box> | ||
); | ||
}; | ||
|
||
export default ReadReceiptIndicator; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 2 additions & 18 deletions
20
apps/meteor/client/views/room/modals/ReadReceiptsModal/ReadReceiptRow.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { IS_EE } from './config/constants'; | ||
import { createAuxContext } from './fixtures/createAuxContext'; | ||
import { Users } from './fixtures/userStates'; | ||
import { HomeChannel } from './page-objects'; | ||
import { createTargetChannel, setSettingValueById } from './utils'; | ||
import { expect, test } from './utils/test'; | ||
|
||
test.use({ storageState: Users.admin.state }); | ||
|
||
test.describe.serial('read-receipts', () => { | ||
let poHomeChannel: HomeChannel; | ||
let targetChannel: string; | ||
|
||
test.skip(!IS_EE, 'Enterprise Only'); | ||
|
||
test.beforeAll(async ({ api }) => { | ||
await setSettingValueById(api, 'Message_Read_Receipt_Enabled', true); | ||
await setSettingValueById(api, 'Message_Read_Receipt_Store_Users', true); | ||
|
||
targetChannel = await createTargetChannel(api); | ||
}); | ||
|
||
test.beforeEach(async ({ page }) => { | ||
poHomeChannel = new HomeChannel(page); | ||
|
||
await page.goto('/home'); | ||
}); | ||
|
||
test('should show read receipts message sent status in the sent message', async ({ browser }) => { | ||
const { page } = await createAuxContext(browser, Users.user1); | ||
const auxContext = { page, poHomeChannel: new HomeChannel(page) }; | ||
await auxContext.poHomeChannel.sidenav.openChat(targetChannel); | ||
await auxContext.poHomeChannel.content.sendMessage('hello admin'); | ||
|
||
await expect(auxContext.poHomeChannel.content.lastUserMessage.getByRole('status', { name: 'Message sent' })).toBeVisible(); | ||
await auxContext.page.close(); | ||
}); | ||
|
||
test('should show read receipts message viewed status in the sent message', async () => { | ||
await poHomeChannel.sidenav.openChat(targetChannel); | ||
await expect(poHomeChannel.content.lastUserMessage.getByRole('status', { name: 'Message viewed' })).toBeVisible(); | ||
}); | ||
|
||
test('should show the reads receipt modal with the users who read the message', async ({ page }) => { | ||
await poHomeChannel.sidenav.openChat(targetChannel); | ||
await poHomeChannel.content.openLastMessageMenu(); | ||
await page.locator('role=menuitem[name="Read receipts"]').click(); | ||
|
||
await expect(page.getByRole('dialog').getByRole('listitem')).toHaveCount(2); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from './create-target-channel'; | ||
export * from './setSettingValueById'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters