Skip to content

fix: Keyboard activation doesn't toggle Display menu controls - #41089

Merged
tassoevan merged 7 commits into
developfrom
fix/display-menu-a11y
Jul 2, 2026
Merged

fix: Keyboard activation doesn't toggle Display menu controls#41089
tassoevan merged 7 commits into
developfrom
fix/display-menu-a11y

Conversation

@juliajforesti

@juliajforesti juliajforesti commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

CORE-2319

Proposed changes (including videos or screenshots)

Issue(s)

Steps to test or reproduce

Further comments

Review in cubic

Summary by CodeRabbit

  • New Features

    • Added end-to-end coverage for keyboard navigation in the sidebar Display menu, including view mode, avatars, sorting, and grouping.
  • Bug Fixes

    • Improved keyboard accessibility in the sidebar Display menu so radio buttons, checkboxes, and toggles update reliably when operated via keyboard (e.g., Enter/Space/arrow keys/escape).
  • Chores

    • Published a patch update for @rocket.chat/meteor with the accessibility improvements.

@changeset-bot

changeset-bot Bot commented Jun 26, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f54c7b5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@rocket.chat/meteor Patch
@rocket.chat/core-typings Patch
@rocket.chat/rest-typings Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@dionisio-bot

dionisio-bot Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Looks like this PR is ready to merge! 🎉
If you have any trouble, please check the PR guidelines

@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 121ec8c5-0746-4155-954a-76f6b48ac7f9

📥 Commits

Reviewing files that changed from the base of the PR and between 784df51 and f54c7b5.

📒 Files selected for processing (1)
  • apps/meteor/tests/e2e/sidebar.spec.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/meteor/tests/e2e/sidebar.spec.ts
📜 Recent review details
⏰ Context from checks skipped due to timeout. (5)
  • GitHub Check: 📦 Build Packages
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: CodeQL-Build
  • GitHub Check: Hacktron Security Check
  • GitHub Check: CodeQL-Build

Walkthrough

Interaction handling for the Display menu’s radio buttons and checkboxes moves from addon onChange callbacks to parent menu item onClick handlers across three hooks. New page object helpers and e2e tests cover keyboard activation of the updated menu items.

Changes

Display Menu Keyboard Accessibility

Layer / File(s) Summary
Move interaction to menu item onClick handlers
apps/meteor/client/navbar/NavBarPagesGroup/hooks/useViewModeItems.tsx, apps/meteor/client/navbar/NavBarPagesGroup/hooks/useSortModeItems.tsx, apps/meteor/client/navbar/NavBarPagesGroup/hooks/useGroupingListItems.tsx, .changeset/olive-nails-fix.md
onClick handlers are added to the menu entries for view, sort, and grouping options; the embedded RadioButton and CheckBox addons keep checked state but use no-op onChange, and a changeset entry records the patch release.
E2E keyboard accessibility tests and page object helpers
apps/meteor/tests/e2e/page-objects/fragments/navbar.ts, apps/meteor/tests/e2e/sidebar.spec.ts
New Navbar helpers locate the Display, Sort by, and Group by sections and their menu items; a new e2e suite opens the Display menu and checks keyboard-driven selection and toggle states.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested labels: type: bug

Suggested reviewers: tassoevan, gabriellsh

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main fix: keyboard activation for Display menu controls was not toggling them.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • CORE-2319: Request failed with status code 401

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.12%. Comparing base (2c4292b) to head (f54c7b5).
⚠️ Report is 17 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #41089      +/-   ##
===========================================
- Coverage    70.18%   69.12%   -1.06%     
===========================================
  Files         3368     3433      +65     
  Lines       130022   132349    +2327     
  Branches     22561    23139     +578     
===========================================
+ Hits         91256    91490     +234     
- Misses       35446    37489    +2043     
- Partials      3320     3370      +50     
Flag Coverage Δ
e2e 59.35% <11.11%> (-0.02%) ⬇️
e2e-api 41.12% <ø> (-6.03%) ⬇️
unit 69.95% <100.00%> (-0.18%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@juliajforesti
juliajforesti force-pushed the fix/display-menu-a11y branch from 3d6ee59 to 3d45f5b Compare June 26, 2026 17:48
@juliajforesti juliajforesti added this to the 8.7.0 milestone Jun 29, 2026
@juliajforesti
juliajforesti marked this pull request as ready for review June 29, 2026 19:53
@juliajforesti
juliajforesti requested a review from a team as a code owner June 29, 2026 19:53

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/meteor/tests/e2e/sidebar.spec.ts`:
- Around line 78-87: The sidebar preference setup in sidebar.spec.ts is only
running in test.afterEach, so the starting state is not guaranteed and tests
become order-dependent. Move the same /users.setPreferences call into
test.beforeEach in the sidebar tests so each case starts with the expected
sidebarViewMode, sidebarDisplayAvatar, sidebarSortby, and sidebarShowUnread
values, and keep test.afterEach only for any necessary cleanup. Use the existing
test hooks around the sidebar test suite to ensure isolation between cases.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 444bb92b-28c7-402b-ae36-cb38c2ee030d

📥 Commits

Reviewing files that changed from the base of the PR and between 2c4292b and 784df51.

📒 Files selected for processing (6)
  • .changeset/olive-nails-fix.md
  • apps/meteor/client/navbar/NavBarPagesGroup/hooks/useGroupingListItems.tsx
  • apps/meteor/client/navbar/NavBarPagesGroup/hooks/useSortModeItems.tsx
  • apps/meteor/client/navbar/NavBarPagesGroup/hooks/useViewModeItems.tsx
  • apps/meteor/tests/e2e/page-objects/fragments/navbar.ts
  • apps/meteor/tests/e2e/sidebar.spec.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (2)
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: Hacktron Security Check
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation

Files:

  • apps/meteor/tests/e2e/sidebar.spec.ts
  • apps/meteor/client/navbar/NavBarPagesGroup/hooks/useViewModeItems.tsx
  • apps/meteor/client/navbar/NavBarPagesGroup/hooks/useSortModeItems.tsx
  • apps/meteor/tests/e2e/page-objects/fragments/navbar.ts
  • apps/meteor/client/navbar/NavBarPagesGroup/hooks/useGroupingListItems.tsx
**/*.spec.ts

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

**/*.spec.ts: Use descriptive test names that clearly communicate expected behavior in Playwright tests
Use .spec.ts extension for test files (e.g., login.spec.ts)

Files:

  • apps/meteor/tests/e2e/sidebar.spec.ts
apps/meteor/tests/e2e/**/*.spec.ts

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

apps/meteor/tests/e2e/**/*.spec.ts: All test files must be created in apps/meteor/tests/e2e/ directory
Avoid using page.locator() in Playwright tests - always prefer semantic locators such as page.getByRole(), page.getByLabel(), page.getByText(), or page.getByTitle()
Use test.beforeAll() and test.afterAll() for setup/teardown in Playwright tests
Use test.step() for complex test scenarios to improve organization in Playwright tests
Group related tests in the same file
Utilize Playwright fixtures (test, page, expect) for consistency in test files
Prefer web-first assertions (toBeVisible, toHaveText, etc.) in Playwright tests
Use expect matchers for assertions (toEqual, toContain, toBeTruthy, toHaveLength, etc.) instead of assert statements in Playwright tests
Use page.waitFor() with specific conditions instead of hardcoded timeouts in Playwright tests
Implement proper wait strategies for dynamic content in Playwright tests
Maintain test isolation between test cases in Playwright tests
Ensure clean state for each test execution in Playwright tests
Ensure tests run reliably in parallel without shared state conflicts

Files:

  • apps/meteor/tests/e2e/sidebar.spec.ts
apps/meteor/tests/e2e/**/*.{ts,spec.ts}

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

apps/meteor/tests/e2e/**/*.{ts,spec.ts}: Store commonly used locators in variables/constants for reuse
Follow Page Object Model pattern consistently in Playwright tests

Files:

  • apps/meteor/tests/e2e/sidebar.spec.ts
  • apps/meteor/tests/e2e/page-objects/fragments/navbar.ts
apps/meteor/tests/e2e/page-objects/**/*.ts

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

Utilize existing page objects pattern from apps/meteor/tests/e2e/page-objects/

Files:

  • apps/meteor/tests/e2e/page-objects/fragments/navbar.ts
🧠 Learnings (9)
📚 Learning: 2026-03-16T21:50:37.589Z
Learnt from: amitb0ra
Repo: RocketChat/Rocket.Chat PR: 39676
File: .changeset/migrate-users-register-openapi.md:3-3
Timestamp: 2026-03-16T21:50:37.589Z
Learning: For changes related to OpenAPI migrations in Rocket.Chat/OpenAPI, when removing endpoint types and validators from rocket.chat/rest-typings (e.g., UserRegisterParamsPOST, /v1/users.register) document this as a minor changeset (not breaking) per RocketChat/Rocket.Chat-Open-API#150 Rule 7. Note that the endpoint type is re-exposed via a module augmentation .d.ts in the consuming package (e.g., packages/web-ui-registration/src/users-register.d.ts). In reviews, ensure the changeset clearly states: this is a non-breaking change, the major version should not be bumped, and the changeset reflects a minor version bump. Do not treat this as a breaking change during OpenAPI migrations.

Applied to files:

  • .changeset/olive-nails-fix.md
📚 Learning: 2026-02-24T19:22:48.358Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 38493
File: apps/meteor/tests/e2e/omnichannel/omnichannel-send-pdf-transcript.spec.ts:66-67
Timestamp: 2026-02-24T19:22:48.358Z
Learning: In Playwright end-to-end tests (e.g., under apps/meteor/tests/e2e/...), prefer locating elements by translated text (getByText) and ARIA roles (getByRole) over data-qa attributes. If translation values change, update the corresponding test locators accordingly. Never use data-qa locators. This guideline applies to all Playwright e2e test specs in the repository and helps keep tests robust to UI text changes and accessible semantics.

Applied to files:

  • apps/meteor/tests/e2e/sidebar.spec.ts
📚 Learning: 2026-02-24T19:39:42.247Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 38493
File: apps/meteor/tests/e2e/page-objects/fragments/message.ts:7-7
Timestamp: 2026-02-24T19:39:42.247Z
Learning: In RocketChat e2e tests, avoid using data-qa attributes to locate elements. Prefer semantic locators such as getByRole, getByLabel, getByText, getByTitle and ARIA-based selectors. Apply this rule to all TypeScript files under apps/meteor/tests/e2e to improve test reliability, accessibility, and maintainability.

Applied to files:

  • apps/meteor/tests/e2e/sidebar.spec.ts
  • apps/meteor/tests/e2e/page-objects/fragments/navbar.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In the Rocket.Chat repository, do not reference Biome lint rules in code review feedback. Biome is not used even if biome.json exists; only reference Biome rules if there is explicit, project-wide usage documented. For TypeScript files, review lint implications without Biome guidance unless the project enables Biome rules.

Applied to files:

  • apps/meteor/tests/e2e/sidebar.spec.ts
  • apps/meteor/tests/e2e/page-objects/fragments/navbar.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In this repository (RocketChat/Rocket.Chat), Biome lint rules are not used even if a biome.json exists. When reviewing TypeScript files (e.g., packages/ui-voip/src/providers/useMediaSession.ts), ensure lint suggestions do not reference Biome-specific rules. Rely on general ESLint/TypeScript lint rules and project conventions instead.

Applied to files:

  • apps/meteor/tests/e2e/sidebar.spec.ts
  • apps/meteor/tests/e2e/page-objects/fragments/navbar.ts
📚 Learning: 2026-03-06T18:10:15.268Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 39397
File: packages/gazzodown/src/code/CodeBlock.spec.tsx:47-68
Timestamp: 2026-03-06T18:10:15.268Z
Learning: In tests (especially those using testing-library/dom/jsdom) for Rocket.Chat components, the HTML <code> element has an implicit ARIA role of 'code'. Therefore, screen.getByRole('code') or screen.findByRole('code') will locate <code> elements even without a role attribute. Do not flag findByRole('code') as invalid in reviews; prefer using the implicit role instead of adding role="code" unless necessary for accessibility.

Applied to files:

  • apps/meteor/tests/e2e/sidebar.spec.ts
📚 Learning: 2026-05-06T12:21:44.083Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 40256
File: apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx:121-149
Timestamp: 2026-05-06T12:21:44.083Z
Learning: Field wrappers in rocket.chat/fuselage-forms (Field, FieldLabel, FieldRow, FieldError, FieldHint) auto-create htmlFor/id associations, aria-describedby, and role="alert" for errors. Do not manually set htmlFor, id, aria-describedby, or role attributes when using these wrappers. This automatic wiring does not apply to plain rocket.chat/fuselage components, which require explicit ID wiring per the accessibility docs. In code reviews, prefer using fuselage-forms wrappers for form fields and verify there is no unnecessary manual ID/aria wiring in files that use these wrappers. If a component uses plain fuselage components, ensure proper id wiring as per docs.

Applied to files:

  • apps/meteor/tests/e2e/sidebar.spec.ts
  • apps/meteor/client/navbar/NavBarPagesGroup/hooks/useViewModeItems.tsx
  • apps/meteor/client/navbar/NavBarPagesGroup/hooks/useSortModeItems.tsx
  • apps/meteor/tests/e2e/page-objects/fragments/navbar.ts
  • apps/meteor/client/navbar/NavBarPagesGroup/hooks/useGroupingListItems.tsx
📚 Learning: 2026-03-27T14:52:56.865Z
Learnt from: dougfabris
Repo: RocketChat/Rocket.Chat PR: 39892
File: apps/meteor/client/views/room/contextualBar/Threads/Thread.tsx:150-155
Timestamp: 2026-03-27T14:52:56.865Z
Learning: In Rocket.Chat, there are two different `ModalBackdrop` components with different prop APIs. During review, confirm the import source: (1) `rocket.chat/fuselage` `ModalBackdrop` uses `ModalBackdropProps` based on `BoxProps` (so it supports `onClick` and other Box/DOM props) and does not have an `onDismiss` prop; (2) `rocket.chat/ui-client` `ModalBackdrop` uses a narrower props interface like `{ children?: ReactNode; onDismiss?: () => void }` and handles Escape keypress and outside mouse-up, and it does not forward arbitrary DOM props such as `onClick`. Flag mismatched props (e.g., `onDismiss` passed to the fuselage component or `onClick` passed to the ui-client component) and ensure the usage matches the correct component being imported.

Applied to files:

  • apps/meteor/client/navbar/NavBarPagesGroup/hooks/useViewModeItems.tsx
  • apps/meteor/client/navbar/NavBarPagesGroup/hooks/useSortModeItems.tsx
  • apps/meteor/client/navbar/NavBarPagesGroup/hooks/useGroupingListItems.tsx
📚 Learning: 2025-12-16T17:29:40.430Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 37834
File: apps/meteor/tests/e2e/page-objects/fragments/admin-flextab-emoji.ts:12-22
Timestamp: 2025-12-16T17:29:40.430Z
Learning: In all page-object files under apps/meteor/tests/e2e/page-objects/, import expect from ../../utils/test (Playwright's async expect) instead of from Jest. Jest's expect is synchronous and incompatible with web-first assertions like toBeVisible, which can cause TypeScript errors.

Applied to files:

  • apps/meteor/tests/e2e/page-objects/fragments/navbar.ts
🔇 Additional comments (5)
apps/meteor/client/navbar/NavBarPagesGroup/hooks/useViewModeItems.tsx (1)

32-54: LGTM!

apps/meteor/client/navbar/NavBarPagesGroup/hooks/useSortModeItems.tsx (1)

30-39: LGTM!

apps/meteor/client/navbar/NavBarPagesGroup/hooks/useGroupingListItems.tsx (1)

29-44: LGTM!

apps/meteor/tests/e2e/page-objects/fragments/navbar.ts (1)

77-100: LGTM!

.changeset/olive-nails-fix.md (1)

1-5: LGTM!

Comment thread apps/meteor/tests/e2e/sidebar.spec.ts

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 6 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread apps/meteor/tests/e2e/sidebar.spec.ts
@tassoevan

Copy link
Copy Markdown
Member

I don't get it why onChange is not triggered.

@juliajforesti

juliajforesti commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

I don't get it why onChange is not triggered.

@tassoevan
The thing is: the keyboard focus is managed by react-aria on the <label> element (fuselage's MenuItem), not on the inner <input>. So if the input is not actually focused, the keyboard event won't trigger the input change.

@tassoevan tassoevan added the stat: QA assured Means it has been tested and approved by a company insider label Jul 2, 2026
@dionisio-bot dionisio-bot Bot added the stat: ready to merge PR tested and approved waiting for merge label Jul 2, 2026
@dionisio-bot
dionisio-bot Bot added this pull request to the merge queue Jul 2, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks Jul 2, 2026
@tassoevan
tassoevan added this pull request to the merge queue Jul 2, 2026
Merged via the queue into develop with commit 6da12d7 Jul 2, 2026
81 of 85 checks passed
@tassoevan
tassoevan deleted the fix/display-menu-a11y branch July 2, 2026 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stat: QA assured Means it has been tested and approved by a company insider stat: ready to merge PR tested and approved waiting for merge type: bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants