We're building an app that pulls a list of matching contacts from a 3rd party when a user is typing in the To recipient field. This list is inserted into to the DOM via a new parent element; this list is
not inserted into the native div[role="listbox"] element that holds the matching contacts returned by Gmail.
If the user clicks one of the 3rd party contacts we trigger the composeView.setToRecipients function to update the To recipients via the Array argument for this function. This behaviour works as expected as long as there are no matching contacts returned by Gmail in the native div[role="listbox"] element. If there are matching contacts returned by Gmail in the native div[role="listbox"] element then setToRecipients will include either the most recently hovered-over of these contacts, or the first contact on this list of contacts rather than only using the Array argument.
Does anyone have advice on how to ensure that setToRecipients only ever uses the email addresses that are supplied via the function's Array argument?