From 9b9784f804cccc9dadcd79170011382dd4159879 Mon Sep 17 00:00:00 2001 From: Richard Schreiber Date: Fri, 31 Jan 2025 17:44:29 +0100 Subject: [PATCH] add option to focus CSS-selector instead of root.$el --- src/pretix/static/pretixpresale/js/widget/widget.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pretix/static/pretixpresale/js/widget/widget.js b/src/pretix/static/pretixpresale/js/widget/widget.js index 92ba4400d..f286b742c 100644 --- a/src/pretix/static/pretixpresale/js/widget/widget.js +++ b/src/pretix/static/pretixpresale/js/widget/widget.js @@ -1781,7 +1781,7 @@ var shared_root_methods = { } }); }, - reload: function () { + reload: function (opt) { var url; if (this.$root.is_button) { return; @@ -1904,7 +1904,7 @@ var shared_root_methods = { if (root.$el.contains(document.activeElement)) { root.$nextTick(function() { // wait for redraw, then focus content element for better a11y - root.$el.focus(); + (opt.focus ? document.querySelector(opt.focus) : root.$el).focus(); }); } }