mirror of
https://github.com/pretix/pretix.git
synced 2026-05-08 15:44:02 +00:00
[A11y] move lightbox to native dialog (#5137)
* [A11y] move lightbox to native dialog * fix width-sizing-issue * move button label to aria-label * increase padding for lightbox, so button does not overlay image * Remove unused JS * add close on backdrop-click --------- Co-authored-by: Raphael Michel <michel@rami.io>
This commit is contained in:
committed by
GitHub
parent
6e306055cb
commit
37af6edeab
@@ -696,7 +696,27 @@ $(function () {
|
||||
});
|
||||
|
||||
// Lightbox
|
||||
lightbox.init();
|
||||
(function() {
|
||||
var dialog = document.getElementById("lightbox-dialog");
|
||||
var img = dialog.querySelector("img");
|
||||
var caption = dialog.querySelector("figcaption");
|
||||
$(dialog).on("mousedown", function (e) {
|
||||
if (e.target == this) {
|
||||
// dialog has no padding, so click triggers only on backdrop
|
||||
this.close();
|
||||
}
|
||||
});
|
||||
$("a[data-lightbox]").on("click", function (e) {
|
||||
e.preventDefault();
|
||||
var label = this.querySelector("img").alt;
|
||||
img.src = this.href;
|
||||
img.alt = label;
|
||||
caption.textContent = label;
|
||||
dialog.showModal();
|
||||
});
|
||||
})();
|
||||
|
||||
|
||||
|
||||
// free-range price input auto-check checkbox/set count-input to 1 if 0
|
||||
$("[data-checked-onchange]").each(function() {
|
||||
|
||||
Reference in New Issue
Block a user