From 7aa46cfa6a8831f14b673ce0b9003369c06a606c Mon Sep 17 00:00:00 2001 From: Egon Zemmer Date: Thu, 12 Aug 2021 14:19:55 +0200 Subject: [PATCH] Solve #249: Cannot click on other upload options after one is selected. --- src/uppload.ts | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/uppload.ts b/src/uppload.ts index 7c8e9a82..a61a956a 100644 --- a/src/uppload.ts +++ b/src/uppload.ts @@ -224,16 +224,19 @@ export class Uppload implements IUppload { this.file = { blob: new Blob() }; this.activeService = "default"; this.activeEffect = ""; - const serviceRadio = this.container.querySelector( - `input[type=radio][value='${this.activeService}']` - ); - if (serviceRadio) serviceRadio.setAttribute("checked", "checked"); this.container.style.transition = `${this.transitionDuration}ms`; this.container.style.opacity = "0"; this.update(); let firstService = this.settings.defaultService; if (this.services.length === 3) this.navigate(this.services[2].name); if (firstService) this.navigate(firstService); + const serviceRadio = this.container.querySelector( + `input[type=radio][value='${this.activeService}']` + ); + if (serviceRadio) { + serviceRadio.setAttribute("checked", "checked"); + serviceRadio.checked = true; + } const escape = (e) => { if ((e as KeyboardEvent).key === "Escape" && this.isOpen) this.close(); }; @@ -346,7 +349,7 @@ export class Uppload implements IUppload { }" class="uppload-service-name"> ${ sidebar - ? `` + ? `` : "" } <${ @@ -718,6 +721,13 @@ export class Uppload implements IUppload { defaultServiceLinks.forEach((link) => { const linkFunction = (e: Event) => { const service = link.getAttribute("data-uppload-service"); + const serviceRadio = this.container.querySelector( + `input[type=radio][value='${service}']` + ); + if (serviceRadio) { + serviceRadio.setAttribute("checked", "checked"); + serviceRadio.checked = true; + } if (service) { this.navigate(service); const serviceDiv = this.container.querySelector( @@ -737,10 +747,6 @@ export class Uppload implements IUppload { } catch (error) {} } } - const serviceRadio = this.container.querySelector( - `input[type=radio][value='${service}']` - ); - if (serviceRadio) serviceRadio.setAttribute("checked", "checked"); e.preventDefault(); return false; };