Skip to content

Commit

Permalink
fix: add root element for SingleSelector to make layout easier
Browse files Browse the repository at this point in the history
  • Loading branch information
guoyunhe committed Oct 11, 2024
1 parent fb2a981 commit 046105b
Show file tree
Hide file tree
Showing 5 changed files with 198 additions and 161 deletions.
5 changes: 5 additions & 0 deletions assets/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@
display: flex;
position: relative;

.@{select-prefix}-selection {
width: 100%;
position: relative;
}

.@{select-prefix}-selection-search {
width: 100%;
position: relative;
Expand Down
4 changes: 2 additions & 2 deletions src/Selector/SingleSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const SingleSelector: React.FC<SelectorProps> = (props) => {
}, [item, hasTextInput, placeholder, prefixCls]);

return (
<>
<span className={`${prefixCls}-selection`}>
<span className={`${prefixCls}-selection-search`}>
<Input
ref={inputRef}
Expand Down Expand Up @@ -121,7 +121,7 @@ const SingleSelector: React.FC<SelectorProps> = (props) => {
{item.label}
</span>
) : null}
</>
</span>
);
};

Expand Down
72 changes: 40 additions & 32 deletions tests/__snapshots__/Combobox.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,29 @@ exports[`Select.Combobox renders controlled correctly 1`] = `
class="rc-select-selector"
>
<span
class="rc-select-selection-search"
class="rc-select-selection"
>
<input
aria-autocomplete="list"
aria-controls="rc_select_TEST_OR_SSR_list"
aria-expanded="false"
aria-haspopup="listbox"
aria-owns="rc_select_TEST_OR_SSR_list"
autocomplete="off"
class="rc-select-selection-search-input"
id="rc_select_TEST_OR_SSR"
role="combobox"
type="search"
value=""
/>
<span
class="rc-select-selection-placeholder"
class="rc-select-selection-search"
>
Search
<input
aria-autocomplete="list"
aria-controls="rc_select_TEST_OR_SSR_list"
aria-expanded="false"
aria-haspopup="listbox"
aria-owns="rc_select_TEST_OR_SSR_list"
autocomplete="off"
class="rc-select-selection-search-input"
id="rc_select_TEST_OR_SSR"
role="combobox"
type="search"
value=""
/>
<span
class="rc-select-selection-placeholder"
>
Search
</span>
</span>
</span>
</div>
Expand All @@ -41,25 +45,29 @@ exports[`Select.Combobox renders correctly 1`] = `
class="rc-select-selector"
>
<span
class="rc-select-selection-search"
class="rc-select-selection"
>
<input
aria-autocomplete="list"
aria-controls="rc_select_TEST_OR_SSR_list"
aria-expanded="false"
aria-haspopup="listbox"
aria-owns="rc_select_TEST_OR_SSR_list"
autocomplete="off"
class="rc-select-selection-search-input"
id="rc_select_TEST_OR_SSR"
role="combobox"
type="search"
value=""
/>
<span
class="rc-select-selection-placeholder"
class="rc-select-selection-search"
>
Search
<input
aria-autocomplete="list"
aria-controls="rc_select_TEST_OR_SSR_list"
aria-expanded="false"
aria-haspopup="listbox"
aria-owns="rc_select_TEST_OR_SSR_list"
autocomplete="off"
class="rc-select-selection-search-input"
id="rc_select_TEST_OR_SSR"
role="combobox"
type="search"
value=""
/>
<span
class="rc-select-selection-placeholder"
>
Search
</span>
</span>
</span>
</div>
Expand Down
Loading

0 comments on commit 046105b

Please sign in to comment.