mirror of
https://github.com/pretix/pretix.git
synced 2026-05-09 15:54:03 +00:00
[A11y] Widget: pass doc title in overlay to iframe.title (#5210)
This commit is contained in:
committed by
GitHub
parent
cced9cd768
commit
362ac8de6f
@@ -7,4 +7,12 @@ var inIframe = function () {
|
|||||||
};
|
};
|
||||||
if (inIframe()) {
|
if (inIframe()) {
|
||||||
document.documentElement.classList.add('in-iframe');
|
document.documentElement.classList.add('in-iframe');
|
||||||
|
try {
|
||||||
|
window.parent.postMessage({
|
||||||
|
type: "pretix:widget:title",
|
||||||
|
title: document.title,
|
||||||
|
}, "*");
|
||||||
|
} catch (e) {
|
||||||
|
console.error("Could not post message to parent.", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -939,7 +939,18 @@ Vue.component('pretix-overlay', {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
mounted () {
|
||||||
|
window.addEventListener('message', this.onMessage, false);
|
||||||
|
},
|
||||||
|
unmounted () {
|
||||||
|
window.removeEventListener('message', this.onMessage, false);
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
onMessage: function(e) {
|
||||||
|
if (e.data.type && e.data.type == "pretix:widget:title") {
|
||||||
|
this.$el.querySelector("iframe").title = e.data.title;
|
||||||
|
}
|
||||||
|
},
|
||||||
lightboxClose: function () {
|
lightboxClose: function () {
|
||||||
this.$root.lightbox = null;
|
this.$root.lightbox = null;
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user