Skip to content

Conversation

@Kiarokh
Copy link
Contributor

@Kiarokh Kiarokh commented Aug 7, 2025

fix #3636

Summary by CodeRabbit

  • New Features

    • Added language support to the Table component, allowing selection labels to be displayed in multiple languages.
    • Selection checkboxes in tables now have accessible, localized labels for both selecting all rows and individual rows.
  • Style

    • Improved checkbox styling to visually hide labels while maintaining accessibility.
  • Bug Fixes

    • Ensured that selection checkboxes remain accessible and user-friendly in all supported languages.

Review:

  • Commits are atomic
  • Commits have the correct type for the changes made
  • Commits with breaking changes are marked as such

Browsers tested:

(Check any that applies, it's ok to leave boxes unchecked if testing something didn't seem relevant.)

Windows:

  • Chrome
  • Edge
  • Firefox

Linux:

  • Chrome
  • Firefox

macOS:

  • Chrome
  • Firefox
  • Safari

Mobile:

  • Chrome on Android
  • iOS

Copilot AI review requested due to automatic review settings August 7, 2025 10:27
@Kiarokh Kiarokh requested a review from a team as a code owner August 7, 2025 10:27
@coderabbitai
Copy link

coderabbitai bot commented Aug 7, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

📝 Walkthrough

Walkthrough

This change introduces accessible, localized labels for table selection checkboxes. It adds translation keys for "select all rows" and "select this row" in multiple languages, updates the table and checkbox components to use these labels, and visually hides the labels while keeping them accessible for screen readers.

Changes

Cohort / File(s) Change Summary
Checkbox label visual hiding
src/components/checkbox/checkbox.scss
Adds a .hide-label CSS rule that visually hides the checkbox label but keeps it accessible and clickable.
Table selection accessibility and i18n
src/components/table/table-selection.ts, src/components/table/table-selection.spec.ts, src/components/table/table.tsx
Updates table selection and table components to support localized, accessible labels for selection checkboxes; adds a language prop, translation function, and applies the .hide-label class.
New translation keys
src/translations/en.ts, src/translations/da.ts, src/translations/de.ts, src/translations/fi.ts, src/translations/fr.ts, src/translations/nl.ts, src/translations/no.ts, src/translations/sv.ts
Adds table.select-all and table.select-row keys with localized strings in eight languages.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Table
    participant TableSelection
    participant Checkbox
    participant Translations

    User->>Table: Render Table with language
    Table->>Translations: getTranslation('table.select-all')
    Translations-->>Table: Localized "Select all rows"
    Table->>Checkbox: Render select-all Checkbox (label, class="hide-label")
    User->>Checkbox: Interact (label visually hidden, accessible for screen readers)
    Table->>TableSelection: Construct TableSelection(getTranslation)
    TableSelection->>Translations: getTranslation('table.select-row')
    Translations-->>TableSelection: Localized "Select this row"
    TableSelection->>Checkbox: Render row Checkbox (label, class="hide-label")
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~15 minutes

Assessment against linked issues

Objective Addressed Explanation
Add proper, accessible labels to table selection checkboxes (#3636)
Visually hide labels but keep them accessible and clickable (#3636)
Ensure labels do not toggle with state and are consistent (#3636)

Assessment against linked issues: Out-of-scope changes

No out-of-scope changes found.

Possibly related PRs

Suggested labels

accessibility, visual design

Suggested reviewers

  • LucyChyzhova
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch checkbox-label-table

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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

This PR adds accessibility improvements to table row selection by providing screen reader support through translated labels for select-all and select-row checkboxes. The implementation maintains visual design while enhancing accessibility.

  • Adds translation keys for table selection labels across 8 languages
  • Implements a language prop for the table component to support internationalization
  • Introduces CSS styling to visually hide labels while keeping them accessible to screen readers

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/translations/*.ts Adds translation keys for table selection labels in 8 languages
src/components/table/table.tsx Adds language prop and integrates translation function for accessibility labels
src/components/table/table-selection.ts Updates constructor to accept translation function and adds labels to checkboxes
src/components/table/table-selection.spec.ts Updates test to include mock translation function
src/components/checkbox/checkbox.scss Adds styling to hide labels visually while maintaining accessibility
etc/lime-elements.api.md Updates API documentation to include new language property

import { TableSelection } from './table-selection';
import { mapLayout, Layout } from './layout';
import { areRowsEqual } from './utils';
import { Languages } from '../date-picker/date.types';
Copy link

Copilot AI Aug 7, 2025

Choose a reason for hiding this comment

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

Importing Languages type from the date-picker component creates an unintended dependency. Consider moving this shared type to a common types file or creating a dedicated types file for language definitions.

Copilot uses AI. Check for mistakes.
@coderabbitai coderabbitai bot changed the title @coderabbitai Add accessible, localized labels for table selection checkboxes Aug 7, 2025
@github-actions
Copy link

github-actions bot commented Aug 7, 2025

Documentation has been published to https://lundalogik.github.io/lime-elements/versions/PR-3637/

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ecd12c3 and d57fd25.

⛔ Files ignored due to path filters (1)
  • etc/lime-elements.api.md is excluded by !etc/lime-elements.api.md
📒 Files selected for processing (12)
  • src/components/checkbox/checkbox.scss (1 hunks)
  • src/components/table/table-selection.spec.ts (1 hunks)
  • src/components/table/table-selection.ts (2 hunks)
  • src/components/table/table.tsx (5 hunks)
  • src/translations/da.ts (1 hunks)
  • src/translations/de.ts (1 hunks)
  • src/translations/en.ts (1 hunks)
  • src/translations/fi.ts (1 hunks)
  • src/translations/fr.ts (1 hunks)
  • src/translations/nl.ts (1 hunks)
  • src/translations/no.ts (1 hunks)
  • src/translations/sv.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{ts,tsx}

⚙️ CodeRabbit Configuration File

**/*.{ts,tsx}: Imports from other files in the same module (lime-elements) must use relative paths. Using absolute paths for imports will cause the production build to fail.

Files:

  • src/translations/en.ts
  • src/translations/fi.ts
  • src/translations/fr.ts
  • src/components/table/table-selection.spec.ts
  • src/translations/de.ts
  • src/translations/no.ts
  • src/translations/nl.ts
  • src/translations/sv.ts
  • src/translations/da.ts
  • src/components/table/table-selection.ts
  • src/components/table/table.tsx
src/components/**/*.scss

📄 CodeRabbit Inference Engine (.cursor/rules/css-class-names-in-components-using-shadow-dom.mdc)

Do not use BEM-style class names in CSS for components, as components use shadow-DOM.

Files:

  • src/components/checkbox/checkbox.scss
**/*.{tsx,scss}

⚙️ CodeRabbit Configuration File

**/*.{tsx,scss}: Almost all our components use shadow-DOM. Therefore, we have no need of BEM-style class names in our CSS.

Files:

  • src/components/checkbox/checkbox.scss
  • src/components/table/table.tsx
**/*.tsx

📄 CodeRabbit Inference Engine (.cursor/rules/wrap-multiple-jsx-elements-in-host-not-in-array.mdc)

When returning multiple JSX elements from the render method, never wrap them in an array literal. Instead, always wrap them in the special <Host> element. When there is already a single top-level element, it does not have to be wrapped in <Host>.

Files:

  • src/components/table/table.tsx

⚙️ CodeRabbit Configuration File

**/*.tsx: Our .tsx files are typically using StencilJS, not React. When a developer wants to return multiple top-level JSX elements from the render method, they will sometimes wrap them in an array literal. In these cases, rather than recommending they add key properties to the elements, recommend removing the hardcoded array literal. Recommend wrapping the elements in StencilJS's special <Host> element.

Files:

  • src/components/table/table.tsx
src/components/**/*.tsx

⚙️ CodeRabbit Configuration File

src/components/**/*.tsx: When contributors add new props to existing components in the lime-elements repository, they should always add documentation examples that demonstrate the new prop's usage and explain how it works. This helps with user adoption, feature discoverability, and maintains comprehensive documentation.

Files:

  • src/components/table/table.tsx
🧠 Learnings (8)
📚 Learning: examples in lime elements use shadow dom (with `shadow: true` in the component decorator) for style ...
Learnt from: Kiarokh
PR: Lundalogik/lime-elements#3518
File: src/components/notched-outline/examples/notched-outline-basic.scss:11-22
Timestamp: 2025-04-14T10:01:18.721Z
Learning: Examples in Lime Elements use Shadow DOM (with `shadow: true` in the component decorator) for style encapsulation, making additional class-based selectors unnecessary. This ensures styles are automatically scoped to each component without leaking to the rest of the application.

Applied to files:

  • src/components/checkbox/checkbox.scss
📚 Learning: in components using shadow dom (like those in lime-elements), the universal selector `*` is already ...
Learnt from: adrianschmidt
PR: Lundalogik/lime-elements#3529
File: src/components/ai-avatar/ai-avatar.scss:20-22
Timestamp: 2025-04-29T14:15:32.104Z
Learning: In components using Shadow DOM (like those in lime-elements), the universal selector `*` is already scoped to the component's shadow tree and won't cause unwanted side effects outside the component. There's no functional difference between `*` and `:host *` in this context.

Applied to files:

  • src/components/checkbox/checkbox.scss
📚 Learning: applies to src/components/**/*.scss : do not use bem-style class names in css for components, as com...
Learnt from: CR
PR: Lundalogik/lime-elements#0
File: .cursor/rules/css-class-names-in-components-using-shadow-dom.mdc:0-0
Timestamp: 2025-07-21T00:27:58.489Z
Learning: Applies to src/components/**/*.scss : Do not use BEM-style class names in CSS for components, as components use shadow-DOM.

Applied to files:

  • src/components/checkbox/checkbox.scss
📚 Learning: in the lime-elements repository, css custom properties prefixed with `--lime-` are considered intern...
Learnt from: Kiarokh
PR: Lundalogik/lime-elements#3529
File: src/components/lime-ai-avatar/lime-ai-avatar.scss:1-3
Timestamp: 2025-04-25T14:23:56.018Z
Learning: In the lime-elements repository, CSS custom properties prefixed with `--lime-` are considered internal implementation details and should not be documented in JSDoc comments, while other custom properties should be documented as they are part of the public API.

Applied to files:

  • src/components/checkbox/checkbox.scss
📚 Learning: in lime-elements, css custom properties follow a specific naming convention: 1. internal use variabl...
Learnt from: Kiarokh
PR: Lundalogik/lime-elements#3529
File: src/components/lime-ai-avatar/lime-ai-avatar.scss:24-28
Timestamp: 2025-04-25T14:22:02.157Z
Learning: In lime-elements, CSS custom properties follow a specific naming convention:
1. Internal use variables (not for consumers) are prefixed with `--limel-component-name-`
2. External use variables (intended for consumers) are prefixed with `--component-name-`
Variables documented with JSDoc comments are typically meant for external use.

Applied to files:

  • src/components/checkbox/checkbox.scss
📚 Learning: in lime-elements, css custom properties like `--limel-theme-surface-background-color` are applied at...
Learnt from: Kiarokh
PR: Lundalogik/lime-elements#3624
File: src/components/button-group/button-group.scss:115-118
Timestamp: 2025-07-30T14:20:41.791Z
Learning: In lime-elements, CSS custom properties like `--limel-theme-surface-background-color` are applied at :root level via `core-styles.scss` and should be expected to be available without fallbacks. The library's architecture guarantees these theme variables are present, so adding fallbacks would be redundant and go against the design intention.

Applied to files:

  • src/components/checkbox/checkbox.scss
📚 Learning: in limel-chip-set, the onclick handler should be placed on the content div (
) ra...
Learnt from: Kiarokh
PR: Lundalogik/lime-elements#3518
File: src/components/chip-set/chip-set.tsx:367-385
Timestamp: 2025-04-14T12:22:22.298Z
Learning: In limel-chip-set, the onClick handler should be placed on the content div (<div slot="content">) rather than on the limel-notched-outline component, and should only be applied when type is 'input'.

Applied to files:

  • src/components/checkbox/checkbox.scss
📚 Learning: in lime elements components that use shadow dom (with `shadow: true` in the component decorator), ke...
Learnt from: Kiarokh
PR: Lundalogik/lime-elements#3529
File: src/components/lime-ai-avatar/lime-ai-avatar.scss:96-122
Timestamp: 2025-04-25T14:18:07.755Z
Learning: In Lime Elements components that use Shadow DOM (with `shadow: true` in the component decorator), keyframe animation names don't need to be namespaced as they are automatically scoped to the component and won't collide with animations from other components.

Applied to files:

  • src/components/checkbox/checkbox.scss
🧬 Code Graph Analysis (2)
src/components/table/table-selection.ts (4)
src/components/table/element-pool.ts (1)
  • ElementPool (1-67)
src/components/table/table.types.ts (1)
  • RowData (217-219)
src/components/file/file.tsx (1)
  • getTranslation (230-232)
src/components/file-viewer/file-viewer.tsx (1)
  • getTranslation (444-446)
src/components/table/table.tsx (1)
src/components/date-picker/date.types.ts (1)
  • Languages (16-25)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Docs / Publish Docs
  • GitHub Check: Test
  • GitHub Check: Build
🔇 Additional comments (18)
src/translations/en.ts (1)

53-54: Translation keys added correctly

'table.select-all' and 'table.select-row' follow the existing naming pattern and use clear, concise phrasing.

src/components/checkbox/checkbox.scss (2)

75-82: Confirm intent of reduced clickable area for hidden labels

Switching label width from 100% (default rule) to $box-size inside the .hide-label scope shrinks the clickable target to just the checkbox, whereas the previous implementation allowed clicking the whole label area. This is a usability trade-off—screen-reader accessibility is kept, but pointer usability is reduced.

Please double-check with design/UX that limiting the hit-area is intentional for row-selection checkboxes in limel-table.


75-82: No BEM violations, rule looks solid

Class name .hide-label is a simple modifier and does not conflict with the “no-BEM in Shadow DOM” guideline. The mixin usage and opacity technique are appropriate for visually hiding while preserving accessibility.

src/translations/nl.ts (1)

55-56: Dutch translations look good

Phrasing is idiomatic and consistent with existing keys.

src/translations/fi.ts (1)

54-55: Finnish translations look good

Keys match the English source and grammar is correct.

src/translations/de.ts (1)

55-56: German translations look good

Terminology aligns with current UI wording.

src/translations/no.ts (1)

53-55: ✓ Norwegian keys added and phrased correctly

The new keys follow the existing naming convention and grammar looks good.

src/translations/sv.ts (1)

53-55: ✓ Swedish translations look accurate and consistent

No issues spotted; key names and phrasing align with the rest of the file.

src/translations/fr.ts (1)

55-57: ✓ French translations added correctly

Keys and language usage are sound and match conventions.

src/translations/da.ts (1)

53-55: ✓ Danish translations added correctly

Keys are consistent; spelling and diacritics look correct.

src/components/table/table-selection.ts (2)

24-30: LGTM! Constructor properly extended with translation support.

The constructor documentation and signature correctly add the getTranslation parameter with proper typing and documentation following the established patterns.


111-113: LGTM! Accessibility improvements properly implemented.

The addition of localized labels and the hide-label CSS class correctly addresses the accessibility issue while maintaining the visual design. The translation key 'table.select-row' is appropriate for row selection checkboxes.

src/components/table/table.tsx (6)

25-26: LGTM! Imports follow coding guidelines.

The relative path imports comply with the coding guidelines for files in the same module.


163-167: LGTM! Language property properly implemented.

The property follows established patterns with proper documentation, typing (Languages), sensible default value ('en'), and appropriate reflection as an attribute.


480-481: LGTM! TableSelection constructor properly updated.

The constructor call correctly passes the translation function callback, integrating well with the updated TableSelection class.


864-872: LGTM! Select-all checkbox accessibility properly implemented.

The addition of the hide-label class and localized label using 'table.select-all' translation key correctly addresses accessibility requirements while maintaining the visual design.


892-894: LGTM! Translation method implemented consistently.

The getTranslation method follows the same pattern used in other components (file.tsx, file-viewer.tsx) and correctly utilizes the translate utility with the component's language property.


872-872: Translation keys verified across all languages

All supported translation files (da.ts, de.ts, en.ts, fi.ts, fr.ts, nl.ts, no.ts, sv.ts) include both

  • table.select-all
  • table.select-row

No missing translations detected.
No further action required.

@Kiarokh Kiarokh force-pushed the checkbox-label-table branch from 78fbdcd to 3c076dd Compare August 7, 2025 11:23
Kiarokh added 4 commits August 7, 2025 14:17
We need a helper class to be used internally by components such as
`limel-table` to hide the `<label>`, while still keeping the checkbox
both clickable for the users, and accessible for screen readers.
Separating this commit for an easier review.
Here is what's added:
1. "Select all rows"
2. "Select this row"
@Kiarokh Kiarokh force-pushed the checkbox-label-table branch from 1531448 to 84270e7 Compare August 7, 2025 12:17
Copy link
Contributor

@civing civing left a comment

Choose a reason for hiding this comment

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

Looks good 🎉

@LucyChyzhova LucyChyzhova merged commit 1fccde6 into main Aug 8, 2025
12 checks passed
@LucyChyzhova LucyChyzhova deleted the checkbox-label-table branch August 8, 2025 07:22
@lime-opensource
Copy link
Collaborator

🎉 This PR is included in version 38.21.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Table: the row selection checkboxes are inaccessible for screen readers

5 participants