From b6007a1af44f500ad253f538662abf9f832b57e6 Mon Sep 17 00:00:00 2001 From: Richard Schreiber Date: Tue, 13 May 2025 10:00:35 +0200 Subject: [PATCH] [A11y] fix widget buy button being disabled (#5084) * [A11y] fix widget buy button being disabled * make dialog an alertdialog for better close-button support --- .../static/pretixpresale/js/widget/widget.js | 38 ++----------------- 1 file changed, 4 insertions(+), 34 deletions(-) diff --git a/src/pretix/static/pretixpresale/js/widget/widget.js b/src/pretix/static/pretixpresale/js/widget/widget.js index 4cb77c7eb..e35f28b29 100644 --- a/src/pretix/static/pretixpresale/js/widget/widget.js +++ b/src/pretix/static/pretixpresale/js/widget/widget.js @@ -848,10 +848,10 @@ var shared_iframe_fragment = ( ); var shared_alert_fragment = ( - '
' + '
' + '' + '
' - + '

{{ $root.error_message }}

' + + '

{{ $root.error_message }}

' + '

' + '

' + '
' @@ -996,7 +996,7 @@ Vue.component('pretix-widget-event-form', { // Form start + '
' - + '
' + + '' + '' + '' + '' @@ -1040,7 +1040,7 @@ Vue.component('pretix-widget-event-form', { // Buy button + '
' - + '' + + '' + '
' + '
' @@ -1064,18 +1064,10 @@ Vue.component('pretix-widget-event-form', { + '
' ), - data: function () { - return { - buy_disabled: true - } - }, mounted: function() { - this.$root.$on('amounts_changed', this.calculate_buy_disabled) this.$root.$on('focus_voucher_field', this.focus_voucher_field) - this.calculate_buy_disabled() }, beforeDestroy: function() { - this.$root.$off('amounts_changed', this.calculate_buy_disabled) this.$root.$off('focus_voucher_field', this.focus_voucher_field) }, computed: { @@ -1151,28 +1143,6 @@ Vue.component('pretix-widget-event-form', { $el.focus(); }); }, - calculate_buy_disabled: function() { - var i, j, k; - for (i = 0; i < this.$root.categories.length; i++) { - var cat = this.$root.categories[i]; - for (j = 0; j < cat.items.length; j++) { - var item = cat.items[j]; - if (item.has_variations) { - for (k = 0; k < item.variations.length; k++) { - var v = item.variations[k]; - if (v.amount_selected) { - this.buy_disabled = false; - return; - } - } - } else if (item.amount_selected) { - this.buy_disabled = false; - return; - } - } - } - this.buy_disabled = true; - } } });