This is an automated email from the ASF dual-hosted git repository.

rusackas pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 87bb752814a fix(select): remove Space wrapper from optionRender to fix 
option label truncation (#44357)
87bb752814a is described below

commit 87bb752814a5abfa3e759f6e3620ebc33874603f
Author: Piyush Raj <[email protected]>
AuthorDate: Sat Oct 3 10:35:55 2026 +0530

    fix(select): remove Space wrapper from optionRender to fix option label 
truncation (#44357)
---
 .../superset-ui-core/src/components/Select/AsyncSelect.test.tsx  | 8 ++++++++
 .../superset-ui-core/src/components/Select/AsyncSelect.tsx       | 3 +--
 .../superset-ui-core/src/components/Select/Select.test.tsx       | 9 +++++++++
 .../packages/superset-ui-core/src/components/Select/Select.tsx   | 3 +--
 4 files changed, 19 insertions(+), 4 deletions(-)

diff --git 
a/superset-frontend/packages/superset-ui-core/src/components/Select/AsyncSelect.test.tsx
 
b/superset-frontend/packages/superset-ui-core/src/components/Select/AsyncSelect.test.tsx
index 28ac3a01c5c..a4a6eda56be 100644
--- 
a/superset-frontend/packages/superset-ui-core/src/components/Select/AsyncSelect.test.tsx
+++ 
b/superset-frontend/packages/superset-ui-core/src/components/Select/AsyncSelect.test.tsx
@@ -1721,6 +1721,14 @@ test('cancels pending debounce on unmount', async () => {
   expect(mockOnSearch).not.toHaveBeenCalled();
 });
 
+test('renders the option label directly in the option content without a Space 
wrapper', async () => {
+  render(<AsyncSelect {...defaultProps} />);
+  await open();
+  const content = getElementByClassName('.ant-select-item-option-content');
+  expect(content.querySelector('.ant-space')).toBeNull();
+  expect(content.firstChild?.nodeType).toBe(Node.TEXT_NODE);
+});
+
 /*
  TODO: Add tests that require scroll interaction. Needs further investigation.
  - Fetches more data when scrolling and more data is available
diff --git 
a/superset-frontend/packages/superset-ui-core/src/components/Select/AsyncSelect.tsx
 
b/superset-frontend/packages/superset-ui-core/src/components/Select/AsyncSelect.tsx
index 6174aed43ca..77417e525a4 100644
--- 
a/superset-frontend/packages/superset-ui-core/src/components/Select/AsyncSelect.tsx
+++ 
b/superset-frontend/packages/superset-ui-core/src/components/Select/AsyncSelect.tsx
@@ -46,7 +46,6 @@ import {
 } from 'antd/es/select';
 import { debounce, isEqual, uniq } from 'lodash-es';
 import { Constants, Icons } from '@superset-ui/core/components';
-import { Space } from '../Space';
 import {
   getValue,
   hasOption,
@@ -904,7 +903,7 @@ const AsyncSelect = forwardRef(
           }
           onClear={handleClear}
           options={fullSelectOptions}
-          optionRender={option => <Space>{option.label || 
option.value}</Space>}
+          optionRender={option => option.label || option.value}
           placeholder={placeholder}
           showSearch={shouldShowSearch}
           tokenSeparators={quoteAwareTokenSeparators}
diff --git 
a/superset-frontend/packages/superset-ui-core/src/components/Select/Select.test.tsx
 
b/superset-frontend/packages/superset-ui-core/src/components/Select/Select.test.tsx
index b34fdf2a785..8d1e4ced85a 100644
--- 
a/superset-frontend/packages/superset-ui-core/src/components/Select/Select.test.tsx
+++ 
b/superset-frontend/packages/superset-ui-core/src/components/Select/Select.test.tsx
@@ -1999,6 +1999,15 @@ test('cancels pending debounce on unmount', async () => {
   await new Promise(resolve => setTimeout(resolve, 400));
   expect(mockOnSearch).not.toHaveBeenCalled();
 });
+
+test('renders the option label directly in the option content without a Space 
wrapper', async () => {
+  render(<Select {...defaultProps} />);
+  await open();
+  const content = getElementByClassName('.ant-select-item-option-content');
+  expect(content.querySelector('.ant-space')).toBeNull();
+  expect(content.firstChild?.nodeType).toBe(Node.TEXT_NODE);
+});
+
 /*
  TODO: Add tests that require scroll interaction. Needs further investigation.
  - Fetches more data when scrolling and more data is available
diff --git 
a/superset-frontend/packages/superset-ui-core/src/components/Select/Select.tsx 
b/superset-frontend/packages/superset-ui-core/src/components/Select/Select.tsx
index 264176a82ff..d4ec1f7b9b4 100644
--- 
a/superset-frontend/packages/superset-ui-core/src/components/Select/Select.tsx
+++ 
b/superset-frontend/packages/superset-ui-core/src/components/Select/Select.tsx
@@ -75,7 +75,6 @@ import {
   TOKEN_SEPARATORS,
   VIRTUAL_THRESHOLD,
 } from './constants';
-import { Space } from '../Space';
 import { Button } from '../Button';
 
 // An option is eligible for a bulk "Select all" when it carries a truthy value
@@ -1055,7 +1054,7 @@ const Select = forwardRef(
             )
           }
           options={visibleOptions}
-          optionRender={option => <Space>{option.label || 
option.value}</Space>}
+          optionRender={option => option.label || option.value}
           oneLine={oneLine}
           popupMatchSelectWidth={oneLine ? dropdownWidth : true}
           builtinPlacements={DROPDOWN_BUILTIN_PLACEMENTS}

Reply via email to