Problem/Motivation
Process details ajax handling code seems to break autcomplete in view filters
Steps to reproduce
Add an autocomplete filter to the process view (initiator for example with new relationship) and open/close a process details: the autocomplete filter field will stop working.
Proposed resolution
Remove probably invalid code in the closeDetails controller.
The first line below seems invalid as no #maestro-ajax-xx can be found in the DOM tree and removing the line fixes the problem.
$response->addCommand(new HtmlCommand('#maestro-ajax-' . $processID, ''));
$response->addCommand(new HtmlCommand('.maestro-status-toggle-' . $processID, $build['expand']));
$response->addCommand(new CssCommand('#details_replace_row_' . $processID, ['display' => 'none']));
May be someone can explain what the first line above is supposed to do exactly?
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | htmlcommand-missing-element-2.png | 62.39 KB | mably |
| #6 | htmlcommand-missing-element-1.png | 61.07 KB | mably |
Issue fork maestro-3420915
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
mably commentedComment #4
mably commentedOk, it looks like the related HTML code is specific to the taskconsole controller: https://git.drupalcode.org/project/maestro/-/blob/3.1.0/modules/maestro_...
Still, after some testing, it seems that the incriminated Ajax
HtmlCommandis not required for the taskconsole.It should probably not be called on the
MaestroEngineProcessDetailsViews fields, where the#maestro-ajax-<id>wrapper is not present, as it seems to break other Ajax elements on the page.We can see while debugging javascript that when the "html" command is executed it calls "detachBehaviors" on the targeted element:
And if the targeted element is not found/undefined it seems to apply the "detachBehaviors" to the whole document:
That might explain why our autocomplete initiator filter doesn't work anymore after closing a details section.
Comment #5
mably commentedComment #6
mably commentedComment #7
mably commentedOk, got it.
It's probably just a copy/paste error in the code: we were referencing the wrong DOM element from the taskconsole.
Fixed in the MR.
Comment #8
mably commentedComment #9
_randy commentedI'll give this patch a go to help alleviate any customization to the base views etc. Just needs a re-roll.
Comment #11
_randy commentedLeaving this open as I will need to check installations to be sure this hasn't broken anything.