
Viewing 3 posts - 1 through 3 (of 3 total)
-
AuthorPosts
-
July 3, 2025 at 1:44 pm #1486274
It is important that in accessibility in America and EU the forms having labels.
I tried with an own function without the sucess.
-
This topic was modified 1 day, 20 hours ago by
Raphael.
July 3, 2025 at 1:45 pm #1486278function footer_js_accessibility() { ?> <script> jQuery(document).ready(function($) { // Überprüfe, ob das übergeordnete Element die korrekte Rolle hat var menu = document.querySelector('.av-main-nav'); if (menu && !menu.hasAttribute('role')) { menu.setAttribute('role', 'menu'); } // Setze die korrekte Rolle für jedes menuitem, falls nicht vorhanden var menuItems = document.querySelectorAll('.menu-item'); menuItems.forEach(function (item) { if (!item.hasAttribute('role')) { item.setAttribute('role', 'menuitem'); } }); // Überprüfe das zweite Menü und setze die entsprechende Rolle var aviaMenu = document.getElementById('avia-menu'); if (aviaMenu && !aviaMenu.hasAttribute('role')) { aviaMenu.setAttribute('role', 'menu'); } var aviaMenuItems = document.querySelectorAll('#avia-menu > li'); aviaMenuItems.forEach(function (item) { if (!item.hasAttribute('role')) { item.setAttribute('role', 'menuitem'); } }); // unabhängig von avia-menu $('li[role="menuitem"]').each(function() { var $this = $(this); var $parentMenu = $this.closest('ul'); if ($parentMenu.length && !$parentMenu.attr('role')) { $parentMenu.attr('role', 'menu'); } }); // Setze Alt-Text für Bilder $('img').each(function() { if (!$(this).attr('alt') || $(this).attr('alt').trim() === '') { var extraText = 'zur Seite'; var pageTitle = document.title.trim(); pageTitle = pageTitle.split('-')[0].trim(); $(this).attr('alt', 'Bilddarstellung ' + extraText + ' ' + pageTitle); } }); // Setze aria-labels für Links ohne aria-label $('a:not([aria-label])').each(function() { var linkText = $(this).text().trim(); if (linkText) { $(this).attr('aria-label', 'Verlinkung auf die Seite ' + linkText); } else { $(this).attr('aria-label', 'Verlinkung für weitere Informationen'); } }); // Setze aria-labels für Links, die nur Zahlen enthalten $('a').each(function() { var linkText = $(this).text().trim(); if (/^\d+$/.test(linkText)) { var ariaLabel = "Gehe zu Quelle Nummer " + linkText; $(this).attr('aria-label', ariaLabel); } }); }); </script> <?php } add_action( 'wp_footer', 'footer_js_accessibility', 10, 10000 );
July 3, 2025 at 8:14 pm #1486285 -
This topic was modified 1 day, 20 hours ago by
-
AuthorPosts
Viewing 3 posts - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.