Skip to content

fix: ats web app select all roles checkbox in edit roles page#831

Open
luigi-io wants to merge 3 commits intodevelopmentfrom
fix/BBND-1322_web_fix_select_all_roles
Open

fix: ats web app select all roles checkbox in edit roles page#831
luigi-io wants to merge 3 commits intodevelopmentfrom
fix/BBND-1322_web_fix_select_all_roles

Conversation

@luigi-io
Copy link
Contributor

@luigi-io luigi-io commented Feb 6, 2026

Signed-off-by: Luigi Navarro luigi@io.builders

Description

Fix select all roles checkbox in edit roles page in ats web app

Type of change

  • Bug fix 🐞
  • New feature ✨
  • Breaking change 💥
  • Documentation update 📖
  • Refactor 🔧

Testing

• Automated tests – npm run ats:test
• Manual verification – Check and uncheck select all roles checkbox in ats web app, with and without other

Node version:

  • 20
  • 22
  • 24

Checklist

  • Style Guidelines followed ✅
  • Documentation Updated 📚
  • Linters - No New Warnings ⚠️
  • Local Tests Pass ✅
  • Effective Tests Added ✔️
  • No reduction of Coverage

Signed-off-by: Luigi Navarro <luigi@io.builders>
Signed-off-by: Luigi Navarro <luigi@io.builders>
@luigi-io luigi-io requested review from a team as code owners February 6, 2026 20:43
@luigi-io luigi-io requested review from Copilot and kpachhai February 6, 2026 20:43
@hedera-eng-infrastructure
Copy link

hedera-eng-infrastructure commented Feb 6, 2026

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes the “Select all roles” interaction on the ATS web app’s edit roles page by preventing unintended toggling behavior and adding automated coverage around the select-all scenarios.

Changes:

  • Updated the select-all UI interaction in HandleRoles to avoid clicking the entire row triggering role selection changes.
  • Added a focused test suite covering select-all behavior for various initial role states.
  • Updated Jest setup to mock @zag-js/focus-visible to prevent JSDOM-related focus issues; added a changeset entry.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
apps/ats/web/src/views/DigitalSecurityDetails/Components/RoleManagement/HandleRoles.tsx Adjusts select-all checkbox/label click handling and adds an accessible name.
apps/ats/web/src/views/DigitalSecurityDetails/Components/RoleManagement/tests/HandleRoles.test.tsx Adds tests validating select-all toggle behavior across multiple starting role configurations.
apps/ats/web/jest.setup.tsx Mocks @zag-js/focus-visible to avoid JSDOM focus property issues during tests.
.changeset/clean-buckets-scream.md Declares a patch release entry describing the fix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 89 to 93
it("should leave only 'admin' role selected when clicking 'Select all roles' checkbox", async () => {
const user = userEvent.setup();
// All available roles for BOND security type
const allRoles = [
"admin",
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

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

This test name says it should “leave only 'admin' role selected”, but the test only asserts the “Select all roles” checkbox becomes unchecked. Update the test name to match the actual expectation, or add assertions that verify the per-role checkbox state (admin checked and others unchecked).

Copilot uses AI. Check for mistakes.
Comment on lines 182 to 185
it("when all selected and clicked, should leave empty array", async () => {
const user = userEvent.setup();
const currentRoles: string[] = [];

Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

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

This test claims the second click “should leave empty array”, but it never verifies the individual role checkboxes are all unchecked (it only checks the select-all checkbox state). Add assertions on the role checkbox states (or on the form value if exposed) to ensure the roles selection is actually cleared.

Copilot uses AI. Check for mistakes.
Comment on lines +94 to 99
aria-label={t("selectAllRoles")}
/>
<Text textStyle="BodyRegularXS" cursor="pointer" onClick={handleSelectAllRoles}>
{t("selectAllRoles")}
</Text>
</HStack>
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

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

The selectable text is implemented as a plain Text with onClick, which is not keyboard-accessible and isn’t semantically associated with the checkbox. Consider using a real <label htmlFor="selectAllRoles"> (or rendering the label as Checkbox children, as done elsewhere in the app) so clicking the label toggles the checkbox while preserving accessibility, without reintroducing the double-toggle issue from the wrapper click handler.

Suggested change
aria-label={t("selectAllRoles")}
/>
<Text textStyle="BodyRegularXS" cursor="pointer" onClick={handleSelectAllRoles}>
{t("selectAllRoles")}
</Text>
</HStack>
>
{t("selectAllRoles")}
</Checkbox>
</HStack>

Copilot uses AI. Check for mistakes.
Comment on lines 91 to 101
// All available roles for BOND security type
const allRoles = [
"admin",
"minter",
"freezer",
"controller",
"pause",
"controlList",
"corporateActions",
"document",
"snapshot",
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

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

This test hard-codes the complete BOND roles list. Since the source of truth already exists in rolesList.tsx, it would be more maintainable to derive allRoles from rolesList (and the mocked security type) so the test doesn’t become stale when roles are added/removed/renamed.

Copilot uses AI. Check for mistakes.
Signed-off-by: Luigi Navarro <luigi@io.builders>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants