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?

Issue fork maestro-3420915

Command icon 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

mably created an issue. See original summary.

mably’s picture

Issue summary: View changes

mably’s picture

Ok, 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 HtmlCommand is not required for the taskconsole.

It should probably not be called on the MaestroEngineProcessDetails Views 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:

javascript debugging 1

And if the targeted element is not found/undefined it seems to apply the "detachBehaviors" to the whole document:

Only local images are allowed.

That might explain why our autocomplete initiator filter doesn't work anymore after closing a details section.

mably’s picture

Status: Active » Needs review
mably’s picture

mably’s picture

Ok, 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.

mably’s picture

Status: Needs review » Reviewed & tested by the community
_randy’s picture

I'll give this patch a go to help alleviate any customization to the base views etc. Just needs a re-roll.

  • mably committed ccef6062 on 3.x
    Issue #3420915 by mably: Remove Ajax command breaking autocomplete in...
_randy’s picture

Status: Reviewed & tested by the community » Needs review

Leaving this open as I will need to check installations to be sure this hasn't broken anything.