Target EntityBrowser in custom validation constraint
I think this is a limitation of Entity Browser module. Drupal is ultimately using setErrorByName() to add the error to the form and Entity Browser does not provide a name attribute that Drupal can attach it to. So if a name attribute is added somewhere in the entity browser widget Drupal could attach the error. That is, Drupal does only visibly attach the error to (visible) input, select and textareas in the form. Other elements may be targeted and get the class &quot;error&quot; added, but this will not show visibly as an error in the form.
I have created a small module to provide the error flagging for the entity browser widget: https://www.drupal.org/project/entity_browser_validation