bito-code-review[bot] commented on code in PR #28171:
URL: https://github.com/apache/superset/pull/28171#discussion_r2920904530


##########
superset-frontend/plugins/plugin-chart-echarts/src/components/Echart.tsx:
##########
@@ -199,6 +199,15 @@ function Echart(
         chartRef.current?.getZr().on(name, handler);
       });
 
+      chartRef.current.setOption(
+        {
+          aria: {
+            enabled: true,
+          },
+          ...echartOptions,
+        },
+        true,
+      );

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Aria configuration misplaced</b></div>
   <div id="fix">
   
   The aria configuration is placed in a separate setOption call that gets 
overridden by the subsequent themed setOption during normal rendering (when not 
refreshing), preventing aria from being enabled. Move the aria setting into the 
base theme to ensure it's included in the final options.
   </div>
   
   
   <details>
   <summary>
   <b>Code suggestion</b>
   </summary>
   <blockquote>Check the AI-generated fix before applying</blockquote>
   <div id="code">
   
   
   ```
    --- superset-frontend/plugins/plugin-chart-echarts/src/components/Echart.tsx
    +++ superset-frontend/plugins/plugin-chart-echarts/src/components/Echart.tsx
    @@ -190,15 +190,6 @@
           Object.entries(zrEventHandlers || {}).forEach(([name, handler]) => {
             chartRef.current?.getZr().off(name);
             chartRef.current?.getZr().on(name, handler);
           });
    -
    -      chartRef.current.setOption(
    -        {
    -          aria: {
    -            enabled: true,
    -          },
    -          ...echartOptions,
    -        },
    -        true,
    -      );
           const getEchartsTheme = (options: any) => {
             const antdTheme = theme;
             const echartsTheme = {
    @@ -212,6 +203,9 @@
               axisPointer: {
                 lineStyle: { color: antdTheme.colorPrimary },
                 label: { color: antdTheme.colorText },
               },
    +          aria: {
    +            enabled: true,
    +          },
             } as any;
             if (options?.xAxis) {
               echartsTheme.xAxis = {
    @@ -276,7 +270,7 @@
           const themedEchartOptions = mergeEchartsThemeOverrides(
             baseTheme,
             echartOptions,
    -        globalOverrides,
    +        globalOverrides,
             chartOverrides,
             animationOverride,
           );
    @@ -288,4 +282,4 @@
           chartRef.current?.setOption(themedEchartOptions, {
             notMerge,
             replaceMerge: notMerge ? undefined : ['series'],
    -        lazyUpdate: isDashboardRefreshing,
    +        lazyUpdate: isDashboardRefreshing,
           });
         }
       }, [didMount, echartOptions, eventHandlers, zrEventHandlers, theme, 
vizType]);
   ```
   
   </div>
   </details>
   
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #a6ac45</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a 
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to