Skip to content

Conversation

@Kiarokh
Copy link
Contributor

@Kiarokh Kiarokh commented Aug 11, 2025

fix #3633

Summary by CodeRabbit

  • New Features
    • None
  • Bug Fixes
    • None
  • Refactor
    • Reworked Checkbox to use native input behavior, removing external UI library dependencies and classes.
    • Streamlined initialization, state synchronization (checked/indeterminate), and change event handling for more reliable behavior.
    • Preserves existing API and expected interactions; indeterminate and checked states continue to function as before.
    • No visual changes expected; lighter component with potential performance and stability improvements.

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 11, 2025 12:00
@coderabbitai
Copy link

coderabbitai bot commented Aug 11, 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

Removed MDC classes and integration from the checkbox component. The template dropped MDC-specific classes. The component now directly manages the native input element, refactoring initialization, teardown, state synchronization, and change emission without MDC. Public APIs remain unchanged.

Changes

Cohort / File(s) Summary
Template cleanup: remove MDC classes
src/components/checkbox/checkbox.template.tsx
Removed MDC class names from wrapper and input; retained existing rendering branches and helpers; no API or logic changes.
Component refactor: remove MDC integration
src/components/checkbox/checkbox.tsx
Deleted MDC imports/fields; refactored to query native input; simplified init/destroy; updated checked/indeterminate synchronization; adjusted change event emission; removed MDC animation class cleanup; no public API changes.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant Checkbox as limel-checkbox
  participant Input as native input[type="checkbox"]
  participant App as App Listener

  User->>Input: Click/toggle
  Input-->>Checkbox: change event
  Checkbox->>Input: Sync checked/indeterminate states
  Checkbox-->>App: Emits change with computed checked value
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~15–20 minutes

Assessment against linked issues

Objective Addressed Explanation
Remove MDC logic and classes from checkbox (#3633)
Maintain teardown/re-initialize behavior on readonly change (#3633) Readonly-specific teardown/reinit handling not evident from the summary.
Update selectors to not rely on MDC classes (#3633)
Ensure components using CheckboxTemplate (e.g., limel-list) still render correctly without MDC (#3633) Cross-component rendering not verifiable from provided changes.

Possibly related issues

Possibly related PRs

Suggested labels

maintenance

Suggested reviewers

  • LucyChyzhova
  • civing
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch checkbox-remove-mdc-dependency

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.
  • 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 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/Issue comments)

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

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.

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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 removes the Material Design Components (MDC) dependency from the checkbox component, replacing MDC-specific functionality with native browser APIs and direct DOM manipulation.

  • Removes MDC checkbox and form field imports and initialization
  • Replaces MDC checkbox state management with direct HTMLInputElement property manipulation
  • Removes MDC-specific CSS classes and animation cleanup logic

Reviewed Changes

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

File Description
src/components/checkbox/checkbox.tsx Removes MDC instances and replaces with native input element management
src/components/checkbox/checkbox.template.tsx Removes MDC-specific CSS classes from the template

@github-actions
Copy link

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

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: 4

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 5a81136 and 263b084.

📒 Files selected for processing (2)
  • src/components/checkbox/checkbox.template.tsx (0 hunks)
  • src/components/checkbox/checkbox.tsx (3 hunks)
💤 Files with no reviewable changes (1)
  • src/components/checkbox/checkbox.template.tsx
🧰 Additional context used
📓 Path-based instructions (4)
**/*.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/checkbox/checkbox.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/checkbox/checkbox.tsx
**/*.{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/components/checkbox/checkbox.tsx
**/*.{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.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/checkbox/checkbox.tsx
⏰ 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: Build
  • GitHub Check: Test

@Kiarokh Kiarokh force-pushed the checkbox-remove-mdc-dependency branch 3 times, most recently from 9f02cb6 to 95f1ca2 Compare August 13, 2025 12:01
@Kiarokh Kiarokh enabled auto-merge (rebase) August 13, 2025 12:02
`shadowRoot` is not available in `connectedCallback` (runs before first render).
So we need to guard against it in `getCheckboxElement` being `null`
to avoid runtime errors.
@Kiarokh Kiarokh force-pushed the checkbox-remove-mdc-dependency branch from 95f1ca2 to 7c68454 Compare August 14, 2025 12:52
@Kiarokh Kiarokh merged commit 2604b5a into main Aug 18, 2025
12 checks passed
@Kiarokh Kiarokh deleted the checkbox-remove-mdc-dependency branch August 18, 2025 07:53
@lime-opensource
Copy link
Collaborator

🎉 This PR is included in version 38.21.4 🎉

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.

checkbox: get rid of MDC dependency

4 participants