Skip to content
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

feat(Icons): icons should be decorative by default #360

Merged
merged 3 commits into from
Feb 26, 2024

Conversation

aversini
Copy link
Collaborator

@aversini aversini commented Feb 26, 2024

Summary by CodeRabbit

  • New Features

    • Enhanced accessibility by introducing a semantic property for icons, replacing the decorative property. This update ensures a clearer differentiation between decorative and semantic icons, improving support for assistive technologies.
  • Refactor

    • Renamed decorative prop to semantic across components, adjusting logic to align with accessibility enhancements.
  • Tests

    • Added tests to validate correct icon rendering based on the semantic property, ensuring icons are properly announced by assistive technologies as needed.

Copy link

coderabbitai bot commented Feb 26, 2024

Walkthrough

The changes across various packages aim to improve accessibility by replacing the decorative property with a semantic property in icon components. This update enhances the distinction between decorative and semantically meaningful icons, benefiting users of assistive technologies. The modifications involve adjusting property names and functionalities in components, updating story configurations, refining type definitions, and adding relevant tests.

Changes

Files Change Summary
.../.ladle/components.tsx
.../src/System/Icons.stories.tsx
.../ui-icons/src/components/Icons/IconsTypes.d.ts
Updated components to replace decorative with semantic for improved accessibility and semantic clarity.
.../ui-private/src/components/SvgIcon/SvgIcon.tsx
.../ui-private/src/components/SvgIcon/SvgIconTypes.d.ts
.../ui-private/src/components/SvgIcon/__tests__/SvgIcon.test.tsx
Renamed and adjusted the decorative property to semantic in SvgIcon components and tests to enhance accessibility features.
.../ui-components/src/components/Bubble/Bubble.tsx Reordered props for conditional rendering of icons within the Bubble component.
.../ui-components/src/components/Button/__tests__/ButtonIcon.test.tsx Removed the decorative prop from IconSettings in ButtonIcon test cases for various configurations.

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
  • 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 generate unit tests for this file.
    • @coderabbitai modularize this function.
  • 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 generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

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.

Review Status

Actionable comments generated: 1

Configuration used: .coderabbit.yaml

Commits Files that changed from the base of the PR and between df63fe6 and b5d9295.
Files selected for processing (6)
  • packages/documentation/.ladle/components.tsx (1 hunks)
  • packages/documentation/src/System/Icons.stories.tsx (1 hunks)
  • packages/ui-icons/src/components/Icons/IconsTypes.d.ts (2 hunks)
  • packages/ui-private/src/components/SvgIcon/SvgIcon.tsx (2 hunks)
  • packages/ui-private/src/components/SvgIcon/SvgIconTypes.d.ts (2 hunks)
  • packages/ui-private/src/components/SvgIcon/tests/SvgIcon.test.tsx (1 hunks)
Additional comments: 8
packages/ui-icons/src/components/Icons/IconsTypes.d.ts (1)
  • 16-21: The addition of the semantic property to the IconsProps interface is correctly implemented, with clear documentation on its purpose and default value. This change enhances accessibility by providing a clearer distinction between decorative and semantic icons.
packages/ui-private/src/components/SvgIcon/SvgIcon.tsx (3)
  • 15-15: Setting the default value of semantic to false in the SvgIcon component is correctly implemented, aligning with the PR objectives.
  • 31-31: Correctly updating the aria-hidden attribute based on the semantic property enhances accessibility by ensuring that only semantic icons are announced to assistive technologies.
  • 37-37: Conditionally rendering the title element based on the semantic property is a good practice for accessibility, ensuring that titles are only provided for semantic icons.
packages/ui-private/src/components/SvgIcon/SvgIconTypes.d.ts (1)
  • 30-35: The addition of the semantic property to the SvgIconProps type is correctly implemented, with clear documentation on its purpose and default value. This change enhances accessibility by explicitly specifying if the icon should be announced to assistive technologies.
packages/documentation/.ladle/components.tsx (1)
  • 56-56: The removal of the decorative prop from the <IconGitHub /> component aligns with the PR objectives of shifting the focus from decorative to semantic icons.
packages/ui-private/src/components/SvgIcon/__tests__/SvgIcon.test.tsx (2)
  • 51-64: The test verifying that icons render as decorative by default is correctly implemented, effectively validating the default behavior of the SvgIcon component.
  • 66-80: The test verifying that the semantic prop is honored is correctly implemented, ensuring that the SvgIcon component behaves as expected when the semantic property is set.

packages/documentation/src/System/Icons.stories.tsx Outdated Show resolved Hide resolved
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.

Review Status

Actionable comments generated: 1

Configuration used: .coderabbit.yaml

Commits Files that changed from the base of the PR and between b5d9295 and f30a3a6.
Files selected for processing (2)
  • packages/ui-components/src/components/Bubble/Bubble.tsx (1 hunks)
  • packages/ui-components/src/components/Button/tests/ButtonIcon.test.tsx (6 hunks)
Additional comments: 1
packages/ui-components/src/components/Bubble/Bubble.tsx (1)
  • 76-76: The removal of the decorative prop from <IconCopied /> and <IconCopy /> aligns with the PR's objective to emphasize semantic over decorative icon handling. However, it's important to ensure that the semantic prop or equivalent logic is correctly implemented elsewhere to maintain accessibility standards. If the semantic prop is intended to replace decorative, its usage should be explicitly handled to ensure icons are accessible to assistive technologies.

Copy link

Bundle Size (components)

Status File Size (Gzip) Limits
style.css 6.89 KB (-9 B -0.13%) 8 KB
index.js 15.95 KB (-2.76 KB -14.74%) 20 KB
vendor.js 65.07 KB 67 KB

Overall bundle size: 87.91 KB (-2.77 KB -3.05%)
Overall status: ✅

Bundle Size (system)

Status File Size (Gzip) Limits
style.css 2.83 KB 4 KB
index.js 1.74 KB 3 KB
vendor.js 44.49 KB 46 KB

Overall bundle size: 49.06 KB
Overall status: ✅

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.

Review Status

Actionable comments generated: 0

Configuration used: .coderabbit.yaml

Commits Files that changed from the base of the PR and between f30a3a6 and 8ccb55f.
Files selected for processing (1)
  • packages/documentation/src/System/Icons.stories.tsx (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • packages/documentation/src/System/Icons.stories.tsx

@aversini aversini merged commit 80abd4a into main Feb 26, 2024
6 checks passed
@aversini aversini deleted the feat(Icons)-icons-should-be-decorative-by-default branch February 26, 2024 23:03
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.

1 participant