Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 2 additions & 20 deletions packages/main/src/FileUploader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,6 @@ class FileUploader extends UI5Element implements IFormInputElement {
@property({ type: Boolean, noAttribute: true })
_tokenizerOpen = false;

static emptyInput: HTMLInputElement;

@i18n("@ui5/webcomponents")
static i18nBundle: I18nBundle;

Expand Down Expand Up @@ -488,18 +486,14 @@ class FileUploader extends UI5Element implements IFormInputElement {
this._clearFileSelection();
}

_onFormSubmit(e: SubmitEvent) {
e.preventDefault();
}

_openFileBrowser() {
this._input.click();
}

_clearFileSelection() {
this._selectedFilesNames = [];
this.value = "";
this._form?.reset();
this._input.files = new DataTransfer().files;
this.fireDecoratorEvent("change", {
files: this.files,
});
Expand All @@ -515,7 +509,7 @@ class FileUploader extends UI5Element implements IFormInputElement {
return this._input.files;
}

return FileUploader._emptyFilesList;
return null;
}

onAfterRendering() {
Expand Down Expand Up @@ -621,18 +615,6 @@ class FileUploader extends UI5Element implements IFormInputElement {
}
}

/**
* in case when the component is not placed in the DOM, return empty FileList, like native input would do
* @private
*/
static get _emptyFilesList() {
if (!this.emptyInput) {
this.emptyInput = document.createElement("input");
this.emptyInput.type = "file";
}
return this.emptyInput.files;
}

get accInfo(): InputAccInfo {
return {
"ariaRoledescription": FileUploader.i18nBundle.getText(FILEUPLOADER_ROLE_DESCRIPTION),
Expand Down
4 changes: 2 additions & 2 deletions packages/main/src/FileUploaderTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default function FileUploaderTemplate(this: FileUploader) {
onDragOver={this._ondrag}
onDrop={this._ondrop}
>
<form class="ui5-file-uploader-form" onSubmit={this._onFormSubmit}>
<div class="ui5-file-uploader-form">
<input
type="file"
class="ui5-file-uploader-native-input"
Expand All @@ -39,7 +39,7 @@ export default function FileUploaderTemplate(this: FileUploader) {
onChange={this._onChange}
data-sap-focus-ref
/>
</form>
</div>

{this.hideInput ? (
<slot></slot>
Expand Down
Loading