Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Size of SelectMenu in SelectWidget. #5863

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
1 change: 1 addition & 0 deletions packages/volto/news/4058.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix the size of Select Menu in SelectWidget to prevent users from having to scroll both the main modal and dropdown menu to view the field choices by adding a menuPortalTarget prop. @victorchrollo14
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change logs should avoid implementation details, as the code covers that.

Suggested change
Fix the size of Select Menu in SelectWidget to prevent users from having to scroll both the main modal and dropdown menu to view the field choices by adding a menuPortalTarget prop. @victorchrollo14
In a modal with a `SelectWidget`, the parent modal no longer requires scrolling to view the choices in the select's options list. @victorchrollo14

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. Thank you.
Shall I wait for the maintainers to review and make all the suggested changes in a single commit.

Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ export const selectTheme = (theme) => ({
});

export const customSelectStyles = {
menuPortal: (base) => ({ ...base, zIndex: 9999 }),
control: (styles, state) => ({
...styles,
border: 'none',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ class SelectWidget extends Component {
options={options}
styles={customSelectStyles}
theme={selectTheme}
maxMenuHeight="13em"
components={{
...(options?.length > 25 && {
MenuList,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ exports[`No 'No value' option when default value is 0 1`] = `
class="react-select__menu css-109xf7j-menu"
>
<div
class="react-select__menu-list css-4ljt47-MenuList"
class="react-select__menu-list css-opcdc2-MenuList"
>
<div
class="react-select__option react-select__option--is-focused react-select__option--is-selected css-zq2nh-option"
Expand Down
Loading