chromium/content/test/data/accessibility/event/report-validity-invalid-field.html

<!--
@WIN-DENY:*
@WIN-ALLOW:EVENT_OBJECT_FOCUS*
@WIN-ALLOW:EVENT_SYSTEM_ALERT*
@WIN-ALLOW:EVENT_OBJECT_LIVE*
@UIA-WIN-DENY:*
@UIA-WIN-ALLOW:AutomationFocusChanged*
@MAC-DENY:*
@MAC-ALLOW:AXFocusedUIElementChanged
@MAC-ALLOW:AXFocusedUIElementChanged
@MAC-ALLOW:AXLiveRegion
-->
<!DOCTYPE html>
<form>
  <label for="in1">Pet name:</label><input id="in1" required>
</form>
<script>
  function go() {
    const in1 = document.querySelector('input');
    in1.setCustomValidity('Please enter pet name');
    in1.reportValidity();
  }
</script>