Skip to content

Commit 6547216

Browse files
committed
simplify logic and add default text to file-select button
1 parent 1e3aa49 commit 6547216

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

packages/mux-uploader/src/mux-uploader-file-select.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export const fileSelectFragment = /*html*/ `
3232
3333
</style>
3434
35-
<button id="file-select" type="button" part="file-select-button"></button>
35+
<button id="file-select" type="button" part="file-select-button">Upload a video</button>
3636
`;
3737

3838
const template = document.createElement('template');
@@ -158,13 +158,7 @@ class MuxUploaderFileSelectElement extends globalThis.HTMLElement {
158158
const text = t('Upload a video', locale);
159159

160160
if (this.filePickerEl) {
161-
// Don't translate text if it's a custom button
162-
const isCustomButton = !this.shadowRoot?.contains(this.filePickerEl) && this.filePickerEl.hasAttribute('slot');
163-
164-
if (!isCustomButton) {
165-
this.filePickerEl.textContent = text;
166-
}
167-
} else {
161+
// Translate text only if it's the default button (inside the shadow DOM)
168162
const buttonEl = this.shadowRoot?.querySelector('#file-select') as HTMLButtonElement;
169163
if (buttonEl) {
170164
buttonEl.textContent = text;

0 commit comments

Comments
 (0)