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

[5.x]: Add new field modal is cut off #15852

Closed
ryanleichty opened this issue Oct 7, 2024 · 4 comments
Closed

[5.x]: Add new field modal is cut off #15852

ryanleichty opened this issue Oct 7, 2024 · 4 comments
Labels

Comments

@ryanleichty
Copy link

What happened?

Description

The add new field modal in the field layout view sits below the screen when you would expect it to show above the add new field button when it's located towards the bottom of the screen (if you're using Floating UI, it's the flip behavior). This makes it really difficult to use in some circumstances. This only applies to when you're editing an entry type in the drawer view.

In addition, the modal doesn't reposition when you scroll, so it's always stuck in the same position.

I would recommend using the Floating UI library. This is what Radix UI uses under the hood (there's a Vue port as well).

Image

Image

Steps to reproduce

  1. Edit an entry type in the drawer view
  2. Add a new field

Expected behavior

The modal should reposition so that it anchors with the add new field button and flips based on which side would better fit the modal contents.

Actual behavior

The modal gets cut off and/or doesn't reposition when you scroll.

Craft CMS version

5.4.4

PHP version

8.2.23

Operating system and version

Linux 6.5.11-linuxkit

Database type and version

MySQL 8.0.37

Image driver and version

Imagick 3.7.0 (ImageMagick 7.1.1-32)

Installed plugins and versions

  • Alt text Generator 5.1.1
  • Amazon S3 2.2.1
  • Asset Usage 4.1.2
  • CKEditor 4.2.0
  • Colour Swatches 5.0.3
  • Donkeytail 5.0.0-beta.1
  • Empty Coalesce 5.0.0
  • Hyper 2.0.5
  • Image Hotspots 3.0.1
  • Neo 5.2.7
  • Retcon 3.2.0
  • Retour 5.0.3
  • Template Selector 5.0.1
@ryanleichty ryanleichty added the bug label Oct 7, 2024
brandonkelly added a commit that referenced this issue Oct 8, 2024
@brandonkelly
Copy link
Member

brandonkelly commented Oct 8, 2024

Thanks for reporting that!

Having the menu always shown below the button was an intentional choice, because otherwise it’s not possible to drag-n-drop the fields into place. But I suppose being able to see the menu at all is more important than being able to drag-n-drop. (It’s still possible to drag the field into the right position after you’ve selected it.) So just removed the “below the button only” mandate, and fixed the scrolling bug as well.

brandonkelly added a commit that referenced this issue Oct 8, 2024
@brandonkelly
Copy link
Member

Realized there’s an obvious solution to the drag-n-drop problem: we can just hide the menu as soon as you start dragging. Made that change as well.

CleanShot.2024-10-08.at.09.31.01.mp4

@ryanleichty
Copy link
Author

Nice, that's a good solve for that 👍

@brandonkelly
Copy link
Member

Craft 4.12.6 and 5.4.7 are out with those changes. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants