HomePhabricator

searchSatisfaction: Allow for async initialisation

Description

searchSatisfaction: Allow for async initialisation

The Vue.js-based search autocomplete widget is mounted only after the
user clicks the server-rendered search input.

Prior to this change, the SearchSatisfaction instrument would select
qualifying search inputs on DOMContentLoaded. Consequently, there's a
race between the Vue.js-based search autocomplete widget mounting and
the SearchSatisfaction instrument loading.

Update the SearchSatisfaction instrument to initialise when the above
events bubble to the body element. This correctly initialises the
instrument when the the user interacts with the server-rendered search
input before and after the Vue.js-based search autocomplete widget has
mounted.

Bug: T274869
Change-Id: I2710b28ea75037174c6309491dfa81ebb012225f
(cherry picked from commit 550918e2a179f41e10c72390f8a6c6cda7638a36)