forked from CGM_Public/pretix_original
[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()) {
|
||||
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: {
|
||||
onMessage: function(e) {
|
||||
if (e.data.type && e.data.type == "pretix:widget:title") {
|
||||
this.$el.querySelector("iframe").title = e.data.title;
|
||||
}
|
||||
},
|
||||
lightboxClose: function () {
|
||||
this.$root.lightbox = null;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user