bito-code-review[bot] commented on code in PR #38705:
URL: https://github.com/apache/superset/pull/38705#discussion_r2957391056
##########
superset-frontend/plugins/plugin-chart-ag-grid-table/src/utils/getCellStyle.ts:
##########
@@ -72,9 +90,20 @@ const getCellStyle = (params: CellStyleParams) => {
const textAlign =
col?.config?.horizontalAlign || (col?.isNumeric ? 'right' : 'left');
+ const resolvedTextColor = getTextColorForBackground(
+ { backgroundColor, color },
+ cellSurfaceColor,
+ );
+ const hoverResolvedTextColor = getTextColorForBackground(
+ { backgroundColor, color },
+ hoverCellSurfaceColor,
+ );
return {
backgroundColor: backgroundColor || '',
+ color: resolvedTextColor ? 'var(--ag-cell-value-color)' : '',
+ '--ag-cell-value-color': resolvedTextColor || '',
+ '--ag-cell-value-hover-color': hoverResolvedTextColor || '',
textAlign,
};
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Incorrect falsy color handling</b></div>
<div id="fix">
The change always sets color and CSS vars to empty strings when text colors
are undefined, but CSS var(--ag-cell-value-color, inherit) uses 'inherit' as
fallback only when the var is unset. Setting it to '' makes text invisible
instead of inheriting the default color. Revert to conditional setting.
</div>
<details>
<summary>
<b>Code suggestion</b>
</summary>
<blockquote>Check the AI-generated fix before applying</blockquote>
<div id="code">
````suggestion
return {
backgroundColor: backgroundColor || '',
...(resolvedTextColor
? {
color: 'var(--ag-cell-value-color)',
'--ag-cell-value-color': resolvedTextColor,
}
: {}),
...(hoverResolvedTextColor
? {
'--ag-cell-value-hover-color': hoverResolvedTextColor,
}
: {}),
textAlign,
};
````
</div>
</details>
</div>
<small><i>Code Review Run #19b7fd</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]