mockup icon indicating copy to clipboard operation
mockup copied to clipboard

LinkFieldWidget inside modal do not work

Open parruc opened this issue 4 months ago • 3 comments

Maybe that's not the right place to open this issue but I'm really unsure whether open it here or in plone mockup patterns or in plone staticresources

When we use LinkFieldWidget inside a modal (I.E. the tile edit form), trying to remove an internal link does not work as it closes the modal.

parruc avatar Jul 16 '25 16:07 parruc

If unsure, use the general CMFPlone issue tracker ... there are more eyes on it.

Nevertheless, I'll move this to mockup since it belongs there

petschki avatar Jul 21 '25 13:07 petschki

I do not know if this is a solution but it's a hint. I solved it by forcing

data-pat-plone-modal='{
        "width": "90%",
        "backdropOptions": {
        "zIndex": "1040",
        "opacity": "0.85",
        "className": "modal-backdrop",
        "classActiveName": "backdrop-active",
        "closeOnEsc": true,
        "closeOnClick": false
    }
}'

Emphasis on closeOnClick": false, so my guess is that the clik on the deselection is misinterpreted as a click outside the modal and the modal is closed.

Forcing closeOnClick to false removed the element not closing the modal. Maybe to avoid those kind of problems the default of closeOnClick could be false?

In this occasion I had access to the link attributes but it's not always the case I guess.

parruc avatar Jul 22 '25 11:07 parruc

this is one solution, but the main cause is pat-contentbrowser which is used for the widget ... I've had this somehwere else too and "quickfixed" it as you with the closeOnClick option, but this should definitely be fixed in contentbrowser's SelectedItems component ...

petschki avatar Jul 22 '25 11:07 petschki