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


##########
superset-frontend/src/dashboard/components/ColorSchemeSelect.tsx:
##########
@@ -172,27 +173,39 @@ const ColorSchemeSelect = ({
 
   return (
     <>
-      <Select
-        css={css`
-          width: 100%;
-          & .ant-select-item.ant-select-item-group {
-            padding-left: ${theme.sizeUnit}px;
-            font-size: ${theme.fontSize}px;
-          }
-          & .ant-select-item-option-grouped {
-            padding-left: ${theme.sizeUnit * 3}px;
-          }
-        `}
-        aria-label={t('Select color scheme')}
-        allowClear={clearable}
-        onChange={onChange}
-        placeholder={t('Select scheme')}
-        value={currentScheme}
-        showSearch
-        getPopupContainer={triggerNode => triggerNode.parentNode}
-        options={options}
-        optionFilterProps={['label', 'value', 'searchText']}
-      />
+      <ClassNames>
+        {({ css: popupCss }) => (
+          <Select
+            css={css`
+              width: 100%;
+            `}
+            // the popup portals to document.body, out of the css prop's
+            // scope, so the grouped-option styles ride along on its root
+            classNames={{
+              popup: {
+                root: popupCss`
+                  .ant-select-item.ant-select-item-group {
+                    padding-left: ${theme.sizeUnit}px;
+                    font-size: ${theme.fontSize}px;
+                  }
+                  .ant-select-item-option-grouped {
+                    padding-left: ${theme.sizeUnit * 3}px;
+                  }
+                `,
+              },
+            }}
+            aria-label={t('Select color scheme')}
+            allowClear={clearable}
+            onChange={onChange}
+            placeholder={t('Select scheme')}
+            value={currentScheme}
+            showSearch
+            getPopupContainer={() => document.body}
+            options={options}
+            optionFilterProps={['label', 'value', 'searchText']}
+          />
+        )}
+      </ClassNames>

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Duplicated popup styling</b></div>
   <div id="fix">
   
   This `classNames.popup.root`/`popupCss` block is copied verbatim into three 
files in this commit (dashboard `ColorSchemeSelect`, explore 
`ColorSchemeControl`, word-cloud plugin copy). The commit message already notes 
the copies drifted, which caused the bug being fixed. Consider extracting one 
shared helper so the grouped-option padding/font rules stay in sync.
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #084cd4</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