Skip to content

feat(charts-ng): improve charts accessibility#1735

Draft
akashsonune wants to merge 1 commit intomainfrom
feat/improve-charts-accessibility
Draft

feat(charts-ng): improve charts accessibility#1735
akashsonune wants to merge 1 commit intomainfrom
feat/improve-charts-accessibility

Conversation

@akashsonune
Copy link
Member

@akashsonune akashsonune commented Mar 24, 2026

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces default ARIA properties to the chart options if they are not already defined. The review suggests refactoring this change to avoid direct mutation of the options parameter, promoting pure transformations and preventing potential side effects, which aligns with the repository's style guide.

Comment on lines +1485 to +1492
if (!options.aria) {
options.aria = {
enabled: true,
label: {
enabled: true
}
};
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

To avoid side effects, it's a best practice to not mutate function parameters. Modifying the options object directly can lead to unexpected behavior in other parts of the application that might be using the same object.

Instead, I suggest creating a new object by spreading the original options and adding the default aria properties. This ensures the function does not have unintended side effects and aligns with the principle of pure transformations.

    if (!options.aria) {
      options = {
        ...options,
        aria: {
          enabled: true,
          label: {
            enabled: true,
          },
        },
      };
    }
References
  1. The repository style guide recommends keeping state transformations pure and predictable (line 36). Although this rule is under the 'State Management' section, the principle of avoiding side effects by not mutating inputs is a general software engineering best practice that applies here. Mutating function arguments is an impure transformation that can cause unpredictable behavior. (link)

@akashsonune akashsonune force-pushed the feat/improve-charts-accessibility branch from a2edff8 to 7d9debe Compare March 25, 2026 07:33
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