-
Notifications
You must be signed in to change notification settings - Fork 13.7k
fix: Keyboard activation doesn't toggle Display menu controls #41089
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
94f573f
33cbb1b
3d45f5b
cb9f9fa
ed193b7
784df51
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@rocket.chat/meteor': patch | ||
| --- | ||
|
|
||
| Enables keyboard activation for Display menu radio buttons and checkboxes |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -74,6 +74,71 @@ test.describe.serial('Sidebar', () => { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| test.describe('Display menu keyboard accessibility', () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| test.afterEach(async ({ api }) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await api.post('/users.setPreferences', { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| data: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| sidebarViewMode: 'extended', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| sidebarDisplayAvatar: true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| sidebarSortby: 'activity', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| sidebarShowUnread: false, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+78
to
+87
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win Seed these preferences before each test, not only after. Lines 78-87 clean up persisted sidebar prefs, but they never establish the starting state for the test that is about to run. That makes this block order-dependent: e.g. Suggested fix test.describe('Display menu keyboard accessibility', () => {
+ test.beforeEach(async ({ api }) => {
+ await api.post('/users.setPreferences', {
+ data: {
+ sidebarViewMode: 'extended',
+ sidebarDisplayAvatar: true,
+ sidebarSortby: 'activity',
+ sidebarShowUnread: false,
+ },
+ });
+ });
+
test.afterEach(async ({ api }) => {
await api.post('/users.setPreferences', {
data: {
sidebarViewMode: 'extended',
sidebarDisplayAvatar: true,
sidebarSortby: 'activity',
sidebarShowUnread: false,
},
});
});As per coding guidelines, "Ensure clean state for each test execution in Playwright tests" and "Maintain test isolation between test cases in Playwright tests". 📝 Committable suggestion
Suggested change
🤖 Prompt for AI AgentsSource: Coding guidelines |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| test('should change view mode using keyboard', async ({ page }) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await poHomeChannel.navbar.btnDisplay.focus(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await page.keyboard.press('Enter'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await expect(poHomeChannel.navbar.menuDisplay).toBeVisible(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await poHomeChannel.navbar.getDisplayMenuItem('Medium').focus(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await page.keyboard.press('Space'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await expect(poHomeChannel.navbar.getDisplayMenuItem('Medium').getByRole('radio')).toBeChecked(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await page.keyboard.press('Escape'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| test('should toggle Avatars using keyboard', async ({ page }) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await poHomeChannel.navbar.btnDisplay.click(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const avatarsItem = poHomeChannel.navbar.getDisplayMenuItem('Avatars'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await avatarsItem.focus(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await page.keyboard.press('Space'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const newAvatarsItem = poHomeChannel.navbar.getDisplayMenuItem('Avatars'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await expect(newAvatarsItem.getByRole('checkbox')).not.toBeChecked(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await page.keyboard.press('Escape'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| test('should change sort mode using keyboard', async ({ page }) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await poHomeChannel.navbar.btnDisplay.focus(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await page.keyboard.press('Enter'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await expect(poHomeChannel.navbar.menuDisplay).toBeVisible(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await poHomeChannel.navbar.getSortMenuItem('Activity').focus(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await page.keyboard.press('ArrowDown'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await expect(poHomeChannel.navbar.getSortMenuItem('Name')).toBeFocused(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await page.keyboard.press('Space'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await expect(poHomeChannel.navbar.getSortMenuItem('Name').getByRole('radio')).toBeChecked(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await page.keyboard.press('Escape'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| test('should toggle grouping using keyboard', async ({ page }) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await poHomeChannel.navbar.btnDisplay.focus(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await page.keyboard.press('Enter'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const unreadItem = poHomeChannel.navbar.getGroupByMenuItem('Unread'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await expect(unreadItem.getByRole('checkbox')).not.toBeChecked(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await unreadItem.focus(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await page.keyboard.press('Space'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await expect(poHomeChannel.navbar.getGroupByMenuItem('Unread').getByRole('checkbox')).toBeChecked(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await page.keyboard.press('Escape'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| test.describe('sidebar', async () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| test('should navigate on sidebar items using arrow keys and restore focus', async ({ page }) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // focus should be on the next item | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: These tests only reset preferences in
afterEachbut never establish the required starting state viabeforeEach. This makes the test suite order-dependent: the first test runs against unknown state, and if any test fails mid-execution,afterEachmay not run, leaving stale state for subsequent tests. Move (or duplicate) this preference initialization into abeforeEachblock to ensure each test starts from a known state.Prompt for AI agents