Fix safari blocking widget opening error url in new tab (Z#23243124)

This commit is contained in:
Kara Engelhardt
2026-08-13 16:57:47 +02:00
parent 7fe31634e6
commit 4f94e1fb66
2 changed files with 22 additions and 23 deletions
@@ -262,7 +262,7 @@ Vue.component('availbox', {
}, },
mounted: function() { mounted: function() {
if (!this.$root.cart_exists && this.$root.itemnum === 1 && (!this.$root.categories[0].items[0].has_variations || this.$root.categories[0].items[0].variations.length < 2) && !this.$root.has_seating_plan ? 1 : 0) { if (!this.$root.cart_exists && this.$root.itemnum === 1 && (!this.$root.categories[0].items[0].has_variations || this.$root.categories[0].items[0].variations.length < 2) && !this.$root.has_seating_plan ? 1 : 0) {
this.$refs.quantity.value = 1; this.$refs.quantity.value = 1;
if (this.order_max === 1) { if (this.order_max === 1) {
this.$refs.quantity.checked = true; this.$refs.quantity.checked = true;
} }
@@ -310,7 +310,7 @@ Vue.component('availbox', {
return this.avail[0] < 100 && this.$root.waiting_list_enabled && this.item.allow_waitinglist; return this.avail[0] < 100 && this.$root.waiting_list_enabled && this.item.allow_waitinglist;
}, },
waiting_list_url: function () { waiting_list_url: function () {
var u = this.$root.target_url + 'w/' + widget_id + '/waitinglist/?locale=' + lang + '&item=' + this.item.id var u = this.$root.target_url + 'w/' + widget_id + '/waitinglist/?locale=' + lang + '&item=' + this.item.id
if (this.item.has_variations) { if (this.item.has_variations) {
u += '&var=' + this.variation.id u += '&var=' + this.variation.id
} }
@@ -863,7 +863,7 @@ var shared_alert_fragment = (
'<dialog :class="alertClasses" role="alertdialog" v-bind:aria-labelledby="$root.parent.html_id + \'-error-message\'" @close="errorClose">' '<dialog :class="alertClasses" role="alertdialog" v-bind:aria-labelledby="$root.parent.html_id + \'-error-message\'" @close="errorClose">'
+ '<form class="pretix-widget-alert-box" method="dialog">' + '<form class="pretix-widget-alert-box" method="dialog">'
+ '<p :id="$root.parent.html_id + \'-error-message\'">{{ $root.error_message }}</p>' + '<p :id="$root.parent.html_id + \'-error-message\'">{{ $root.error_message }}</p>'
+ '<p><button v-if="$root.error_url_after" value="continue" autofocus v-bind:aria-describedby="$root.parent.html_id + \'-error-message\'">' + strings.continue + '</button>' + '<p><button v-if="$root.error_url_after" @click="errorContinue" autofocus v-bind:aria-describedby="$root.parent.html_id + \'-error-message\'">' + strings.continue + '</button>'
+ '<button v-else autofocus v-bind:aria-describedby="$root.parent.html_id + \'-error-message\'">' + strings.close + '</button></p>' + '<button v-else autofocus v-bind:aria-describedby="$root.parent.html_id + \'-error-message\'">' + strings.close + '</button></p>'
+ '</form>' + '</form>'
+ '<transition name="bounce">' + '<transition name="bounce">'
@@ -952,7 +952,7 @@ Vue.component('pretix-overlay', {
cancelBlockedClasses: function () { cancelBlockedClasses: function () {
return { return {
'pretix-widget-visibility-hidden': !this.cancelBlocked, 'pretix-widget-visibility-hidden': !this.cancelBlocked,
} }
}, },
}, },
mounted () { mounted () {
@@ -974,19 +974,18 @@ Vue.component('pretix-overlay', {
this.$root.lightbox.loading = false; this.$root.lightbox.loading = false;
}, },
errorClose: function (e) { errorClose: function (e) {
var dialog = e.target;
if (dialog.returnValue == "continue" && this.$root.error_url_after) {
if (this.$root.error_url_after_new_tab) {
window.open(this.$root.error_url_after);
} else if (this.$root.overlay) {
this.$root.overlay.frame_src = this.$root.error_url_after;
this.$root.frame_loading = true;
}
}
this.$root.error_message = null; this.$root.error_message = null;
this.$root.error_url_after = null; this.$root.error_url_after = null;
this.$root.error_url_after_new_tab = false; this.$root.error_url_after_new_tab = false;
}, },
errorContinue: function () {
if (this.$root.error_url_after_new_tab) {
window.open(this.$root.error_url_after);
} else if (this.$root.overlay) {
this.$root.overlay.frame_src = this.$root.error_url_after;
this.$root.frame_loading = true;
}
},
close: function (e) { close: function (e) {
if (this.$root.frame_loading) { if (this.$root.frame_loading) {
// Chrome does not allow blocking dialog.cancel event more than once // Chrome does not allow blocking dialog.cancel event more than once
@@ -54,16 +54,16 @@ function lightboxLoaded () {
} }
} }
function errorClose (e: Event) { function errorContinue() {
const dialog = e.target as HTMLDialogElement if (store.overlay.errorUrlAfterNewTab) {
if (dialog.returnValue === 'continue' && store.overlay.errorUrlAfter) { window.open(store.overlay.errorUrlAfter)
if (store.overlay.errorUrlAfterNewTab) { } else {
window.open(store.overlay.errorUrlAfter) store.overlay.frameSrc = store.overlay.errorUrlAfter
} else { store.overlay.frameLoading = true
store.overlay.frameSrc = store.overlay.errorUrlAfter
store.overlay.frameLoading = true
}
} }
}
function errorClose () {
store.overlay.errorMessage = null store.overlay.errorMessage = null
store.overlay.errorUrlAfter = null store.overlay.errorUrlAfter = null
store.overlay.errorUrlAfterNewTab = false store.overlay.errorUrlAfterNewTab = false
@@ -200,7 +200,7 @@ Teleport(to="body")
form.pretix-widget-alert-box(method="dialog") form.pretix-widget-alert-box(method="dialog")
p(:id="errorMessageId") {{ store.overlay.errorMessage }} p(:id="errorMessageId") {{ store.overlay.errorMessage }}
p p
button(v-if="store.overlay.errorUrlAfter", value="continue", autofocus, :aria-describedby="errorMessageId") button(v-if="store.overlay.errorUrlAfter", autofocus, :aria-describedby="errorMessageId", @click="errorContinue")
| {{ STRINGS.continue }} | {{ STRINGS.continue }}
button(v-else, autofocus, :aria-describedby="errorMessageId") {{ STRINGS.close }} button(v-else, autofocus, :aria-describedby="errorMessageId") {{ STRINGS.close }}
transition(name="bounce") transition(name="bounce")