1(function ($, Drupal, once) { 2 Drupal.behaviors.fixBrokenAriaReferences = { 3 attach: function (context, settings) { 4 once('fixBrokenAriaReferences', '[aria-labelledby], [aria-describedby], [aria-controls]', context).forEach(function (element) { 5 const $el = $(element); 6 7 const ariaAttrs = ['aria-labelledby', 'aria-describedby', 'aria-controls']; 8 9 ariaAttrs.forEach(function (attr) { 10 const value = $el.attr(attr); 11 if (!value) return; 12 13 // Split multiple IDs (sometimes space-separated) 14 const ids = value.split(/\s+/); 15 const validIds = ids.filter(function (id) { 16 return id && document.getElementById(id); 17 }); 18 19 // If none of the referenced IDs exist â remove the attribute 20 if (validIds.length === 0) { 21 console.warn(`[ARIA Fix] Removed broken ${attr}="${value}" on`, element); 22 $el.removeAttr(attr); 23 } 24 // If only some exist â keep valid ones 25 else if (validIds.length !== ids.length) { 26 console.warn(`[ARIA Fix] Cleaned partial ${attr}="${value}" â "${validIds.join(' ')}"`, element); 27 $el.attr(attr, validIds.join(' ')); 28 } 29 }); 30 }); 31 } 32 }; 33})(jQuery, Drupal, once);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.