← All changes
|
includes/admin/settings/js/settings-admin-scripts.js
+18
-9
4.5.1
→
4.5.2
View file →
| @@ -342,10 +342,14 @@ | ||
| 342 | 342 | template = template.replace(/{{ROW_ID}}/g, uniqueId); |
| 343 | 343 | itemsContainer.append(template); |
| 344 | 344 | index++; |
| 345 | 345 | var newItem = itemsContainer.find('.wz-repeater-item:last'); |
| 346 | - itemsContainer.find('.repeater-item-header:last .toggle-icon').text('\u25b2'); | |
| 347 | - itemsContainer.find('.repeater-item-content:last').css('display', 'block'); | |
| 346 | + itemsContainer.find('.repeater-item-header:last') | |
| 347 | + .attr('aria-expanded', 'true') | |
| 348 | + .find('.toggle-icon').text('\u25b2'); | |
| 349 | + itemsContainer.find('.repeater-item-content:last') | |
| 350 | + .attr('aria-hidden', 'false') | |
| 351 | + .css('display', 'block'); | |
| 348 | 352 | if (window.WebberInitTomSelect) { |
| 349 | 353 | window.WebberInitTomSelect(newItem.get(0)); |
| 350 | 354 | } |
| 351 | 355 | document.dispatchEvent(new CustomEvent('wz:repeater-item-added', { detail: { container: newItem.get(0) } })); |
| @@ -377,17 +381,22 @@ | ||
| 377 | 381 | } |
| 378 | 382 | }); |
| 379 | 383 | |
| 380 | 384 | // Toggle Accordion. |
| 381 | - wrapper.on('click', '.repeater-item-header', function () { | |
| 382 | - var $this = $(this); | |
| 383 | - var $toggleIcon = $this.find('.toggle-icon'); | |
| 384 | - var $content = $this.next('.repeater-item-content'); | |
| 385 | - if ($content.is(':visible')) { | |
| 386 | - $content.slideUp(); | |
| 385 | + wrapper.on('click', '.repeater-item-header', function (e) { | |
| 386 | + e.preventDefault(); | |
| 387 | + e.stopImmediatePropagation(); | |
| 388 | + var $button = $(this); | |
| 389 | + var $toggleIcon = $button.find('.toggle-icon'); | |
| 390 | + var $content = $button.next('.repeater-item-content'); | |
| 391 | + var isExpanded = 'true' === $button.attr('aria-expanded'); | |
| 392 | + if (isExpanded) { | |
| 393 | + $button.attr('aria-expanded', 'false'); | |
| 394 | + $content.attr('aria-hidden', 'true').stop(true, true).hide(); | |
| 387 | 395 | $toggleIcon.text('\u25bc'); |
| 388 | 396 | } else { |
| 389 | - $content.slideDown(); | |
| 397 | + $button.attr('aria-expanded', 'true'); | |
| 398 | + $content.attr('aria-hidden', 'false').stop(true, true).show(); | |
| 390 | 399 | $toggleIcon.text('\u25b2'); |
| 391 | 400 | } |
| 392 | 401 | }); |
| 393 | 402 | |