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

Add Field modal when editing a content type schema needs resizing. #4058

Open
flipmcf opened this issue Dec 6, 2022 · 11 comments · May be fixed by #5863
Open

Add Field modal when editing a content type schema needs resizing. #4058

flipmcf opened this issue Dec 6, 2022 · 11 comments · May be fixed by #5863

Comments

@flipmcf
Copy link

flipmcf commented Dec 6, 2022

Describe the bug
The "Add Field" modal when editing a content type schema is cut off - Select box is too large for window.

To Reproduce
From the control panel -> content types (localhost:3000/controlpanel/dexterity-types )

Edit the schema of any content type (three dots at the end of the row, select 'schema')

Click "select" in the type drop-down.

Note that the list is cut off, and the user must scroll the main window to see the last few choices.

Expected behavior
The main modal shouldn't scroll. Only the dropdown should scroll. You shouldn't have to use 2 scroll bars to get to the "yes / no" field choice.

Screenshots
select_too_long

Software (please complete the following information):

  • OS: Ubuntu 20.04
  • Browser Chrome Version 107.0.5304.121 (Official Build) (64-bit)
    Volto 16.3.0
    Plone 6.0.0rc2
    plone.restapi 8.32.4
    CMF 2.6.0
    Zope 5.7
    Python 3.8.10 (default, Jun 22 2022, 20:18:18) [GCC 9.4.0]
    PIL 9.3.0 (Pillow)
    Add-ons
    @plone/volto-slate 16.3.0
    @eeacms/volto-accordion-block 6.0.0
    @kitconcept/volto-blocks-grid 5.2.0
    @kitconcept/volto-slider-block 4.0.0
    @eeacms/volto-matomo 3.0.1
@MAX-786
Copy link
Contributor

MAX-786 commented Dec 7, 2022

Hello @flipmcf 😊, I think somehow we can reduce the height of the internal (select) component so it fits with an outer view. If you haven't started working on this, I would like to work on this too.

@tiberiuichim tiberiuichim added this to To do in Polished Volto via automation Dec 7, 2022
@JeffersonBledsoe
Copy link
Member

I find this behaviour happens in a few places in Volto. The dropdown always appears to display below the cursor and is contained within the parent of whatever triggered the dropdown, causing you have to scroll the parent to be able to then scroll the dropdown to see the bottom of the list. Looking at the ReactSelect docs (which is what is used for the popups), it looks like there's a menuPlacement prop that we could use. It defaults to bottom but there's an auto value that seems to do the moving behaviour I'd like to see! Also has portal support for rendering it outside of the parent. Could be a useful PR!

@danalvrz
Copy link
Contributor

I implemented the suggested change, by assigning the value auto to the prop menuPlacement in the SelectWidget component, but the issue seems to persist.

ScreenRecording.mov

@victorchrollo14
Copy link
Member

hey @flipmcf , @JeffersonBledsoe.

Adding a maxMenuHeight="10em" prop to the Select component in SelectWidget would fix the issue.
But I'm not sure if it is a good fix, as the SelectWidget component is used in a lot of other components as well.
And it would prevent those components from having the drop-down menu height of greater than 10em.

<Select
          id={`field-${id}`}
          key={choices}
          name={id}
          menuShouldScrollIntoView={false}
          isDisabled={disabled}
          isSearchable={true}
          className="react-select-container"
          classNamePrefix="react-select"
          isMulti={isMulti}
          options={options}
          styles={customSelectStyles}
          theme={selectTheme}
          maxMenuHeight="10em"
          menuPlacement="bottom"
plone-issue-fix.mp4

@stevepiercy
Copy link
Collaborator

Maybe portaling option?

@victorchrollo14
Copy link
Member

Yeah portalling options works as well.
we can add menuPortalTarget={document.body} prop to the select component.
and add

menuPortal: (base) => ({ ...base, zIndex: 9999 }), 

to customSelectStyles in /widgets/SelectStyling.jsx. This seems to be work fine and doesn't break things in other places the component is used in.

Screencast.from.08-03-24.05.51.57.PM.IST.webm

@stevepiercy
Copy link
Collaborator

@victorchrollo14 would you be willing to create a PR for this implementation? It looks good.

@victorchrollo14
Copy link
Member

Yeah, I'll make a Pr for it.

@victorchrollo14
Copy link
Member

hey @stevepiercy. I ran the tests using pnpm test.
The SelectWidget test was failing, then there was an option to update the SelectWidget snapshots, and I updated it, and the test stopped failing. now I have changes in 4 files.

  • SelectWidget.jsx
  • SelectWidget.test.jsx.snap
  • SelectStyling.jsx
  • /packages/volto/news/4058.bugfix ( change log entry )

This is normal right?

I have run pnpm test and pnpm lint, Is there anything else to run before making the commit.
should I run this one as well (https://6.docs.plone.org/volto/contributing/acceptance-tests.html) .

@stevepiercy
Copy link
Collaborator

@victorchrollo14 I'm not a Volto developer. I just do issue triage and documentation for Volto. I think you're on the right path and have satisfied most if not all requirements. When you create a PR, GitHub workflows will run and let you know if you missed anything.

@victorchrollo14
Copy link
Member

Ok. Thank you

victorchrollo14 added a commit to victorchrollo14/volto that referenced this issue Mar 10, 2024
…ing to scroll both the main modal and dropdown menu to view the field choices (plone#4058).
@victorchrollo14 victorchrollo14 linked a pull request Mar 10, 2024 that will close this issue
victorchrollo14 added a commit to victorchrollo14/volto that referenced this issue Mar 11, 2024
…ing to scroll both the main modal and dropdown menu to view the field choices (plone#4058).
victorchrollo14 added a commit to victorchrollo14/volto that referenced this issue Mar 15, 2024
…ing to scroll both the main modal and dropdown menu to view the field choices (plone#4058).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging a pull request may close this issue.

6 participants