An open source design system that's fully customizable and agent ready
TypeScript
fix(Selector): let options ellipsize a long label in a narrow list (#7803)
홍규진2c9a868ce96a
diff --git a/.changeset/selector-option-narrow-ellipsis.md b/.changeset/selector-option-narrow-ellipsis.mdnew file mode 100644index 0000000000..37b22a7039--- /dev/null+++ b/.changeset/selector-option-narrow-ellipsis.md@@ -0,0 +1,6 @@+---+'@astryxdesign/core': patch+---++[fix] Selector options in a narrow list now shrink and truncate a long label with an ellipsis instead of being clipped past the list edge+@kyu-rongdiff --git a/packages/core/src/Selector/Selector.test.tsx b/packages/core/src/Selector/Selector.test.tsxindex dc32eda138..8a92adaa3f 100644--- a/packages/core/src/Selector/Selector.test.tsx+++ b/packages/core/src/Selector/Selector.test.tsx@@ -4809,6 +4809,22 @@ describe('Selector in a narrow row', () => {expect(root.getAttribute('style')).toContain('80');expect(getComputedStyle(root).minWidth).toBe('0');});++ it('lets a narrow list shrink an option so its label can ellipsize', () => {+ render(+ <Selector+ label="Project"+ options={['An option with a deliberately long readable label']}+ value={undefined}+ onChange={() => {}}+ isDefaultOpen+ />,+ );+ const option = screen+ .getByRole('option', {hidden: true})+ .querySelector('.astryx-selector-option')!;+ expect(getComputedStyle(option).minWidth).toBe('0');+ });});describe('Selector and option actions (not adopted)', () => {diff --git a/packages/core/src/Selector/SelectorOption.tsx b/packages/core/src/Selector/SelectorOption.tsxindex 61b857c207..72b7e76a60 100644--- a/packages/core/src/Selector/SelectorOption.tsx+++ b/packages/core/src/Selector/SelectorOption.tsx@@ -22,6 +22,10 @@ const embeddedStyles = stylex.create({paddingBlock: 0,paddingInline: 0,borderRadius: 0,+ // The host row lays this out as a flex item, whose automatic minimum+ // size is the full label width. Without the reset a long label runs+ // past a narrow popover and is clipped instead of ellipsizing.+ minWidth: 0,},});