Skip to content

Commit cf63bbe

Browse files
committed
fix: A11y should not affect dom width render
resolve ant-design/ant-design#23786
1 parent 12a0859 commit cf63bbe

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

src/OptionList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ const OptionList: React.RefForwardingComponent<
241241

242242
return (
243243
<>
244-
<div role="listbox" id={`${id}_list`} style={{ height: 0, overflow: 'hidden' }}>
244+
<div role="listbox" id={`${id}_list`} style={{ height: 0, width: 0, overflow: 'hidden' }}>
245245
{renderItem(activeIndex - 1)}
246246
{renderItem(activeIndex)}
247247
{renderItem(activeIndex + 1)}

tests/__snapshots__/OptionList.test.tsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ exports[`OptionList renders correctly 1`] = `
55
<div
66
id="undefined_list"
77
role="listbox"
8-
style="height: 0px; overflow: hidden;"
8+
style="height: 0px; width: 0px; overflow: hidden;"
99
>
1010
<div
1111
aria-selected="false"

tests/__snapshots__/Select.test.tsx.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ exports[`Select.Basic does not filter when filterOption value is false 1`] = `
3535
<div
3636
id="undefined_list"
3737
role="listbox"
38-
style="height:0;overflow:hidden"
38+
style="height:0;width:0;overflow:hidden"
3939
>
4040
<div
4141
aria-selected="false"
@@ -469,7 +469,7 @@ exports[`Select.Basic render renders dropdown correctly 1`] = `
469469
<div
470470
id="undefined_list"
471471
role="listbox"
472-
style="height:0;overflow:hidden"
472+
style="height:0;width:0;overflow:hidden"
473473
>
474474
<div
475475
aria-selected="false"
@@ -701,7 +701,7 @@ exports[`Select.Basic should contain falsy children 1`] = `
701701
<div
702702
id="undefined_list"
703703
role="listbox"
704-
style="height:0;overflow:hidden"
704+
style="height:0;width:0;overflow:hidden"
705705
>
706706
<div
707707
aria-selected="true"
@@ -833,7 +833,7 @@ exports[`Select.Basic should render custom dropdown correctly 1`] = `
833833
<div
834834
id="rc_select_TEST_OR_SSR_list"
835835
role="listbox"
836-
style="height: 0px; overflow: hidden;"
836+
style="height: 0px; width: 0px; overflow: hidden;"
837837
>
838838
<div
839839
aria-selected="false"

tests/__snapshots__/Tags.test.tsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ exports[`Select.Tags OptGroup renders correctly 1`] = `
8484
<div
8585
id="rc_select_TEST_OR_SSR_list"
8686
role="listbox"
87-
style="height: 0px; overflow: hidden;"
87+
style="height: 0px; width: 0px; overflow: hidden;"
8888
>
8989
<div
9090
aria-selected="false"

0 commit comments

Comments
 (0)