diff options
| author | Roger Rehnelt <noreply@maennchen1.de> | 2026-10-03 14:58:50 +0200 |
|---|---|---|
| committer | Roger Rehnelt <noreply@maennchen1.de> | 2026-10-03 14:58:50 +0200 |
| commit | e20207af3fe77ddec29c5e4b63a0502331adc2c0 (patch) | |
| tree | b8621fbbfae591595af5e22d65c0fca3dcfe3da6 /views/mods/mod_productvariants/frontend.js | |
| parent | 33700f5616024266e3a94be23dc8b056998ac3b4 (diff) | |
Produktvarianten: Fokus bleibt nach dem Variantenwechsel auf der Auswahl
Nach dem Nachladen per Ajax stand der Fokus auf der Seite; mit der Tastatur musste man neu ansetzen.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'views/mods/mod_productvariants/frontend.js')
| -rw-r--r-- | views/mods/mod_productvariants/frontend.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/views/mods/mod_productvariants/frontend.js b/views/mods/mod_productvariants/frontend.js index 66db90d..2d4957a 100644 --- a/views/mods/mod_productvariants/frontend.js +++ b/views/mods/mod_productvariants/frontend.js @@ -3,6 +3,10 @@ {
var template_index = jQuery(event.target).closest('.wpsg_mod_productvariants_product_wrap').attr('wpsg-productindex');
+
+ // Nach dem Nachladen steht der Fokus wieder auf der Auswahl, nicht auf body (Tastatur, W4)
+ var focus_id = event.target.id || '';
+ var focus_image = jQuery(event.target).closest('.wpsg_vp_update_image').data('wpsg-id');
wpsg_blockProductTemplate(template_index);
@@ -19,6 +23,12 @@ jQuery('#wpsg_produktform_' + template_index).replaceWith(data);
if (typeof refreshFsLightbox === 'function') refreshFsLightbox();
+
+ var form = document.getElementById('wpsg_produktform_' + template_index);
+ var focus = ((focus_id !== '')?document.getElementById(focus_id):null);
+ if (!focus && form && typeof focus_image !== 'undefined') focus = form.querySelector('.wpsg_vp_update_image[data-wpsg-id="' + focus_image + '"]');
+ if (!focus && form) focus = form.querySelector('.wpsg_vp_update, .wpsg_vp_update_image');
+ if (focus) focus.focus();
}
} );
|
