-
-
Notifications
You must be signed in to change notification settings - Fork 639
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
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for plone-components canceled.
|
✅ Deploy Preview for volto canceled.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR needs review from a maintainer. I only reviewed the change log entry.
@@ -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 |
There was a problem hiding this comment.
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.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@victorchrollo14 this is not a good fix, it looks bad to show the select options below the modal which has the grey overlay to bring focus only to the modal content.
I would do the following:
- set overflow: hidden instead of auto
- give a max height for the react-select__menu added in this modal to avoid
going over the content area as just having overflow hidden means that URL
is hidden as seen in my screenshot
EDIT:
You could try also without any overflow set on that content parent as hidden might hide something down the line or in responsive mode
@ichim-david. Initially I tried adding a maxMenuHeight prop to select component which fixes the issue in Screencast.from.10-03-24.06.39.56.PM.IST.webmI do agree that showing the select options below the modal looks bad. What do you think would be better to use, should we go with the |
@victorchrollo14 I appreciate the fact that you've done research and mentioned other places where we have these react-select input and how it would look, well done, it shows a good level of commitment to thinking of a fix that would be acceptable for more than one place. That menu does not look good if it goes outside of the content area as it is and is for sure no no in a modal. I would rather have the extra scrolling rather than this look as at least that is all enclosed in the section that contains these elements and in the case of add user I find it acceptable to use scrolling to get to the options I need. We had some changes on the contents panel where a designer added some bottom breathing area for situations You can continue to experiment if you like but take into consideration that again it has to look good in order |
64fa697
to
136bbe8
Compare
hey @ichim-david . I went through most of the pages where the SelectWidget is being used. I added a
What do you think? Would this be fine or should we try some other alternative solutions for this problem. Screencast.from.11-03-24.10.09.34.PM.IST.webmScreencast.from.11-03-24.10.02.37.PM.IST.webm |
@victorchrollo14 I don't see the maxHeightMenu prop after your latest commits and force-push. look at the changes |
…ing to scroll both the main modal and dropdown menu to view the field choices (plone#4058).
933bd92
to
4bfeeb0
Compare
@ichim-david. I just tried it locally earlier, I've pushed it now. |
React select has the default max-height of 300px set. You would set it to 13em which I think would be calculated from I'm not comfortable with thinking this is a good solution to basically say that anytime you use the select widget it has a max height of 182px instead of the default 300. Maybe 200, 250px might be a better default for us but again I am always in favor of not messing a lot with the defaults and modifying those defaults as needed per context. If we do set the maxMenuHeight and we decide on a default that we think is more sensible than 300 we still need to ensure that someone can pass a prop and modify this value. |
For this scenario, instead of the select menu popping downward, and assuming it uses popper.js, it should automatically detect in which direction it should pop up. Does this select menu not use popper.js? Here are docs for reference. https://floating-ui.com/docs/react See also related issue and pull requests:
I agree with @ichim-david that changing defaults would be a last resort because of its impacts throughout the UI. Finally, what happened to using |
@stevepiercy it's using react-select library. |
@ichim-david would this example work? https://react-select.com/advanced#portaling. I asked in #4058 (comment), but that seems to have been lost in this PR. @victorchrollo14? |
@ichim-david yeah, I agree. putting a default value would affect different parts of the UI. if we are not aware of all the places it is being used, we might break some ui as well. adding maxHeight in css makes it look like below. In the route In order to fix the issue with schema modal. We could go with a default of 215px, which is the maximum maxMenuHeight we can put for the modal in |
@victorchrollo14? |
Fixes #4058.
Fixes the Size of Select Menu in SelectWidget, whose height was greater than the height of parent modal as a result users had to scroll both the Select menu as well the main modal to view all the field choices.
The Issue is fixed by passing a menuPortalTarget prop into the Select Menu, that renders the select menu directly in document.body rather than the parent Modal as a result when the height of select menu is greater than the parent modal the users won't have to scroll the select menu as well as the parent modal to view all the field choices.
Screencast.from.08-03-24.05.51.57.PM.IST.webm