cwrc / DEPRECATED-CWRC-Writer

The Canadian Writing Research Collaboratory (CWRC) is developing an in-browser text markup editor (CWRCWriter) for use by collaborative scholarly editing projects.
http://www.cwrc.ca/projects/infrastructure-projects/technical-projects/cwrc-writer/
GNU General Public License v2.0
24 stars 17 forks source link

AJAX events fired by other page items causes all modals to open #391

Closed midnightLuke closed 8 years ago

midnightLuke commented 8 years ago

If you use another element with ajax on a page that has loaded the CWRC Writer then CWRC Writer fires all modal windows at once with no way to close them. The working example is trying to bookmark anything causes them all to open over the page with no way to close them (beyond opening dev tools and deleting them from the DOM).

See here: http://cwrc-dev-06.srv.ualberta.ca/islandora/object/islandora%3Ac5049c36-f3e8-4f51-bdcd-b37cbaf7d60f

Note that this does not actually stop the event from completing or saving, just opens modals that cannot be closed over it. We aren't clear on what is happening here, but we have checked out the newfixes branch and are up to date with that on the link above.

ghost commented 8 years ago

Thanks, Luke. High priority action item, Open Sky folks!

On May 26, 2016, at 11:30 AM, Luke Bainbridge notifications@github.com wrote:

If you use another element with ajax on a page that has loaded the CWRC Writer then CWRC Writer fires all modal windows at once with no way to close them. The working example is trying to bookmark anything causes them all to open over the page with no way to close them (beyond opening dev tools and deleting them from the DOM).

See here: http://cwrc-dev-06.srv.ualberta.ca/islandora/object/islandora%3Ac5049c36-f3e8-4f51-bdcd-b37cbaf7d60f http://cwrc-dev-06.srv.ualberta.ca/islandora/object/islandora%3Ac5049c36-f3e8-4f51-bdcd-b37cbaf7d60f Note that this does not actually stop the event from completing or saving, just opens modals that cannot be closed over it. We aren't clear on what is happening here, but we have checked out the newfixes branch and are up to date with that on the link above.

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/cwrc/CWRC-Writer/issues/391

ajmacdonald commented 8 years ago

It looks like the ajax success callback is causing CWRC-Writer to reload, which is re-inserting all the divs. The divs have the same ID, so when jquery attempts to turn them into dialogs, it targets the initially inserted div, and doesn't perform the proper hiding process etc. on the newly inserted div. ajax

ghost commented 8 years ago

Excellent progress by the sounds of it. Can you fix it?

On May 26, 2016, at 1:40 PM, Andrew notifications@github.com wrote:

It looks like the ajax success callback is causing CWRC-Writer to reload, which is re-inserting all the divs. The divs have the same ID, so when jquery attempts to turn them into dialogs, it targets the initially inserted div, and doesn't perform the proper hiding process etc. on the newly inserted div. https://cloud.githubusercontent.com/assets/882444/15584189/7110ce94-2347-11e6-9c3b-9c67d86d0802.png — You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/cwrc/CWRC-Writer/issues/391#issuecomment-221941950

ajmacdonald commented 8 years ago

This is a non-trivial fix. If it can be explained why CWRC-Writer needs to be reloaded then I will put the time into fixing it, but it seems to me like the reloading shouldn't be occurring in the first place.

midnightLuke commented 8 years ago

@ajmacdonald Thanks for the insight here, this actually indicates an issue with the module that wraps the CWRC-Writer for Drupal.

Drupal fires all attach functions after any ajax event (or maybe any DOM modification at all, I don't remember) as a way to let developers check for things like new form elements that they need to modify.

The javascript for the module doesn't use "once" or any other mechanism for safeguarding against this behaviour so we are going to see if we can quickly resolve this on the module end, thanks again!

ajmacdonald commented 8 years ago

You're welcome!