backdrop-contrib / references_dialog

Extends reference fields by adding links to add, edit, and search for references through a dialog.
https://backdropcms.org/project/references_dialog
GNU General Public License v2.0
1 stars 4 forks source link

Update "Create" link to "Edit" after closing dialog #12

Closed olafgrabienski closed 3 weeks ago

olafgrabienski commented 3 years ago

I've encountered a subtle but serios usability issue when creating multiple references through a dialog:

When I add a reference node through the dialog, save it, and the dialog gets closed, the "Create" link of the original form says still "Create Xyz". This is especially confusing in a form where you can create multiple references. In this case, to continue, you have to click the button "Add another item" below the References Dialog field. Instead, me and an editor of the site were repeatedly tempted to click the "Create Xyz" link.

Btw, once you click the "Add another item" button, the "Create" link text changes to "Edit". That should just happen one moment earlier.

Steps to reproduce: https://github.com/backdrop-contrib/references_dialog/issues/12#issuecomment-1617672717

Here's a short video which shows the behavior:

https://user-images.githubusercontent.com/14188307/139468061-3cb9a148-620f-4fd0-89b0-16aa238c2c95.mov

robertgarrigos commented 1 year ago

@olafgrabienski right now, this doesn't seem to apply any more (I cannot reproduce it). Are you still having this problem? Thanks.

olafgrabienski commented 1 year ago

Thanks for asking! Yes, I'm still seeing the issue. To be sure, I've reproduced it on a vanilla Backdrop demo site. These are the steps to reproduce:

  1. Install and enable References Dialog.
  2. Enable a Reference module, e.g. Entity Reference from Backdrop core.
  3. Add a Entity Reference field to the Post content type widget. (Label: Related pages, Widget: Autocomplete, Target type: Node, Target bundles: Page)
  4. Enable "Edit dialog" and "Add dialog", provided by References Dialog.
  5. Create a new Post. In the Post form, click the link "Create Page" below the Entity Reference field.
  6. Fill the Page form (using the dialog), and save the Page.

Actual behavior

The Page dialog is closed. The link below the Entity References field of the Post form didn't change. There is still a "Create page" link.

Expected behavior

There is an "Edit" link below the Entity References field.

robertgarrigos commented 1 year ago

Thanks @olafgrabienski. I see it, now. But I don't know how to fix it....

robertgarrigos commented 1 year ago

I guess this is something related to the module not reattaching behaviours after closing de dialog. I've been struggling to add Backdrop.attachBehaviors(document, Backdrop.settings); somewhere after closing, but it does nothing. Only clicking on "add another" field button seems to do the job.

olafgrabienski commented 1 year ago

Thanks for your effort! Maybe somebody can help us then. I've added the help wanted label and may ask in the Zulip chat.

robertgarrigos commented 2 months ago

I had another look into this. I realize that core's dialog, used in entity_reference, has the same problem.