codeant-ai-for-open-source[bot] commented on code in PR #40985:
URL: https://github.com/apache/superset/pull/40985#discussion_r3417421856


##########
superset-frontend/packages/superset-ui-core/src/components/Select/styles.tsx:
##########
@@ -45,10 +45,11 @@ export const StyledContainer = styled.div<{ headerPosition: 
string }>`
 export const StyledSelect = styled(Select, {
   shouldForwardProp: prop => prop !== 'headerPosition' && prop !== 'oneLine',
 })<{ headerPosition?: string; oneLine?: boolean }>`
-  ${({ theme, headerPosition, oneLine }) => `
+  ${({ theme, headerPosition, oneLine }) => {
+    const useSubtleOptionHover = theme.selectOptionActiveOutline === false;
+    return `
     .ant-select-item-option-active:not(.ant-select-item-option-disabled) {
-      outline: 2px solid ${theme.colorPrimary};
-      outline-offset: -2px;
+      ${useSubtleOptionHover ? 'outline: none;' : `outline: 2px solid 
${theme.colorPrimary}; outline-offset: -2px;`}

Review Comment:
   **Suggestion:** The fallback logic is inverted: when 
`selectOptionActiveOutline` is unset (the default), this code applies a 2px 
outline to active options, which changes default UI behavior instead of keeping 
the previous no-op styling. Make the default path preserve existing behavior 
(no outline) and only enable the outline when the token is explicitly turned 
on. [incorrect condition logic]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ⚠️ All core Select dropdowns gain new active option outline.
   - ⚠️ Theme token cannot enable outline only when explicitly set.
   ```
   </details>
   <details>
   <summary><b>Steps of Reproduction ✅ </b></summary>
   
   ```mdx
   1. Run the frontend with this PR and open any UI that uses the shared Select 
component
   from `@superset-ui/core/components`, for example the Word Rotation control 
in Explore
   
(`plugins/plugin-chart-word-cloud/src/plugin/controls/RotationControl.tsx:34-54`),
 which
   renders `<Select ... />`.
   
   2. Note that the exported `Select` component used there is implemented in
   `packages/superset-ui-core/src/components/Select/Select.tsx`, which in turn 
renders
   `StyledSelect` from `./styles` (`Select.tsx:58-64`), so all such controls 
share the same
   styling defined in `styles.tsx`.
   
   3. With a default theme (no custom SupersetSpecificTokens provided), the 
theme object is
   of type `SupersetTheme = SharedAntdTokens & SupersetSpecificTokens`
   (`packages/superset-core/src/theme/types.ts:112-150, 497`), and
   `selectOptionActiveOutline?: boolean;` is only declared as optional 
(`types.ts:134-136`)
   and not assigned anywhere else in the repo, so at runtime
   `theme.selectOptionActiveOutline` is `undefined`.
   
   4. When you open the Select dropdown and hover or keyboard-navigate options, 
the CSS
   generated at `styles.tsx:48-52` runs: `useSubtleOptionHover =
   theme.selectOptionActiveOutline === false` evaluates to `false` for the 
default
   `undefined` value, so the `.ant-select-item-option-active` rule applies 
`outline: 2px
   solid ${theme.colorPrimary}; outline-offset: -2px;`, introducing a new 2px 
focus outline
   on active options by default instead of preserving the prior no-outline 
behavior unless
   the token is explicitly turned on.
   ```
   </details>
   
   [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=eee6b786906c4187a72f7552dff5ca61&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=eee6b786906c4187a72f7552dff5ca61&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** 
superset-frontend/packages/superset-ui-core/src/components/Select/styles.tsx
   **Line:** 49:52
   **Comment:**
        *Incorrect Condition Logic: The fallback logic is inverted: when 
`selectOptionActiveOutline` is unset (the default), this code applies a 2px 
outline to active options, which changes default UI behavior instead of keeping 
the previous no-op styling. Make the default path preserve existing behavior 
(no outline) and only enable the outline when the token is explicitly turned on.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve 
this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask 
user if the user wants to fix the rest of the comments as well. if said yes, 
then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F40985&comment_hash=2f101dd334785616cb185de81b7ac0f40904c19ead336d64442000b78e098e32&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F40985&comment_hash=2f101dd334785616cb185de81b7ac0f40904c19ead336d64442000b78e098e32&reaction=dislike'>👎</a>



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