Problem/Motivation

The formUpdated event isn't triggered when selecting an option from the autocomplete suggestion list. This problem only exists when using the selection dropdown, while typing in the actual textfield the event triggers nicely.

Proposed resolution

Explicitly triggering the formUpdated event from the selectHandler seems to be the most straight forward solution.

Remaining tasks

None

User interface changes

None

API changes

None

Data model changes

None

Comments

Erik Frèrejean created an issue. See original summary.

Erik Frèrejean’s picture

droplet’s picture

Status: Needs review » Needs work
+++ b/core/misc/autocomplete.js
@@ -184,6 +184,7 @@
       terms.push(ui.item.value);
...
+    $(event.target).trigger('formUpdated');

formUpdated.autocomplete

"selectHandler" handler is overrideable. Should we trigger it via a jQuery UI event?
http://api.jqueryui.com/autocomplete/#event-select

Placed inside Drupal.behaviors.autocomplete.attach?

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.