Correctly sets tabindex to 0 on move up / down buttons that are inactive....
5 unresolved threads
Correctly sets tabindex to 0 on move up / down buttons that are inactive. Includes a number of other related javascript optimizations.
Closes #3423427
Merge request reports
Activity
17 17 const { element, method } = uiElement; 18 18 $container[method]($(element).addClass('js-lpb-ui')); 19 19 }); 20 Drupal.attachBehaviors($container[0], drupalSettings); 106 105 * @param {jQuery} $element The builder element. 107 106 */ 108 107 function updateMoveButtons($element) { 109 $element.find('.lpb-up, .lpb-down').attr('tabindex', '0'); 110 $element 111 .find( 112 '.js-lpb-component:first-of-type .lpb-up, .js-lpb-component:last-of-type .lpb-down', 113 ) 114 .attr('tabindex', '-1'); 108 [...$element[0].querySelectorAll('.lpb-up, .lpb-down')].forEach((el) => { 171 $sibling.css({ transform: `translateY(${b}px)` }); 172 }, 173 complete() { 174 $moveItem.css({ transform: 'none' }); 175 $sibling.css({ transform: 'none' }); 176 $sibling[method]($moveItem); 177 $moveItem 178 .closest(`[${idAttr}]`) 179 .trigger('lpb-component:move', [$moveItem.attr('data-uuid')]); 180 }, 181 }, 182 ); 183 if (distance > 50) { 184 $('html, body').animate({ scrollTop: destScroll }); 163 // Determine if the move should be animated horizontally or vertically. 164 const animateProp = $sibling[0].getBoundingClientRect().top == $moveItem[0].getBoundingClientRect().top 530 }); 531 // Add new containers to the dragula instance. 532 $('.js-lpb-region:not(.is-dragula-enabled)', element) 533 .addClass('is-dragula-enabled') 534 .get() 535 .forEach((c) => { 536 const drake = $(element).data('drake'); 537 drake.containers.push(c); 538 }); 537 $element.data('drake', initDragAndDrop($element, lpbSettings)); 538 attachEventListeners($element, lpbSettings); 539 $element.trigger('lpb-builder:init'); 539 540 }); 541 542 // Add new containers to the dragula instance. 543 once('is-dragula-enabled', '.js-lpb-region').forEach((c) => { 501 515 Drupal.behaviors.layoutParagraphsBuilder = { 502 516 attach: function attach(context, settings) { 503 517 // Add UI elements to the builder, each component, and each region. 504 $(once('lpb-ui-elements', '[data-has-js-ui-element]')).each((i, el) => { 518 const jsUiElements = once('lpb-ui-elements', '[data-has-js-ui-element]'); added 1 commit
- 34ee2962 - Check to make sure buttons exist before changing attribute
Please register or sign in to reply