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

Modal edit form has no space at top when using "field" parameter #1972

Open
Toutouwai opened this issue Sep 15, 2024 · 4 comments
Open

Modal edit form has no space at top when using "field" parameter #1972

Toutouwai opened this issue Sep 15, 2024 · 4 comments

Comments

@Toutouwai
Copy link

Short description of the issue

PW has a feature where Page Edit can be opened while only showing a field or fields specified in a field URL parameter. E.g. to have the Page Edit form only include the "images" field the URL would be something like /processwire/page/edit/?id=1234&field=images

When the field parameter is used the rest of the Page Edit interface is hidden, so it's common to use this parameter when Page Edit is to be opened in a modal. But the problem is that there's no space above the specified field(s), and the top outline of the inputfield is cut off. This doesn't look right.

2024-09-15_121640

Steps to reproduce the issue

Adding a modal edit link for demonstration:

$wire->addHookAfter('ProcessPageEdit::buildFormContent', function(HookEvent $event) {
    $ppe = $event->object;
    $page = $ppe->getPage();
    $wrapper = $event->return;
    $url = $page->editUrl . '&modal=1&field=images';
    $wrapper->appendMarkup("<a class='pw-modal' href='$url'>Open modal</a>");
});
@ryancramerdesign
Copy link
Member

Your screenshot does show very little space between the header and the field header, which I agree doesn't look quite right. I added your hook code and tested it out, but I'm seeing a better margin here and it looks as expected. Is there some other factor present?

@BernhardBaumrock
Copy link

BernhardBaumrock commented Oct 5, 2024

Hey @ryancramerdesign I'm not sure wether you and Robin are talking from the same. It would be helpful if you provide a screenshot how it looks on your end, as what you mean with "looks as expected" might be different than what Robin is expecting.

For my case I'm seeing the same that Robin describes in all of my ALFRED modals (which are native PW frontend editing modals, so no surprise here):

image

The red line shows what Robin mentioned: When a form is rendered in a modal, there is no space at the top. Whether that is intended or not is the question I guess :)

I guess Robin would expect the form to have equal space at the top as it has on the sides (20px in this case)

@Toutouwai
Copy link
Author

@ryancramerdesign, it's a clean installation of PW 3.0.241

The issue seems to be caused by this CSS:

.ProcessPageEdit.modal {
  form#ProcessPageEdit.ProcessPageEditSingleField {
    margin-top: -20px;
  }
}

If I change that to margin-top: 0 it looks better:

2024-10-06_105435

@BernhardBaumrock
Copy link

I can confirm that robins find is also the responsible rule in my case, even though I have multiple fields (but with the &fields=... param still present).

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

No branches or pull requests

4 participants