Unfortunately, core's entity reference elements cannot find decoupled users because the autocomplete searches by username, even though it displays the display name.
web/core/modules/user/src/Plugin/EntityReferenceSelection/UserSelection.php uses the username field to search for autocomplete matches:
protected function buildEntityQuery
...
if (isset($match)) {
$query->condition('name', $match, $match_operator);
}
The only generic solution I can see is to store the display name in a field on the user entity, and then alter the entity reference query (hopefully with a hook, or an EntityReferenceSelection plugin if no hook suits) to filter by this new field instead of the username field.
This would also have the advantage of providing a relatively good solution out of the box for the problem of the name field on Views that I reported in #2630356: Make sure user views are not impacted by decoupling.
Comments
Comment #2
jonathanshawThis overlaps conceptually with #2663496: Add Primary Fields