@skyux/forms 14.0.0-beta.0 → 14.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1870,8 +1870,8 @@ class SkyFileAttachmentComponent {
1870
1870
  }
1871
1871
  deleteFileAttachment() {
1872
1872
  const fileName = this.value?.file.name;
1873
- this.value = undefined;
1874
- this.#emitFileChangeEvent(this.value);
1873
+ this.#onTouched();
1874
+ this.#emitFileChangeEvent(undefined);
1875
1875
  /* istanbul ignore else: safety check */
1876
1876
  if (fileName) {
1877
1877
  this.#announceState('skyux_file_attachment_file_upload_file_removed', fileName);
@@ -1926,9 +1926,13 @@ class SkyFileAttachmentComponent {
1926
1926
  this.fileErrorValidation = undefined;
1927
1927
  }
1928
1928
  else {
1929
+ const hadValue = this.value !== undefined;
1929
1930
  this.writeValue(undefined);
1930
- // Makes sure value accessor is marked as dirty even if current file is undefined
1931
- this.#onChange(undefined);
1931
+ // Make sure value accessor is marked as dirty when a validation failure occurs
1932
+ // and the control value remains undefined.
1933
+ if (!hadValue) {
1934
+ this.#onChange(undefined);
1935
+ }
1932
1936
  this.fileErrorValidation = { fileError: true };
1933
1937
  this.fileErrorName = currentFile?.errorType;
1934
1938
  this.fileErrorParam = currentFile?.errorParam;