1. PROMO Upgrade to Pro Membership @ $99 / Lifetime & access all our 16+ premium Divi extensions: Divi Block, Carousel Toolkit, etc.LEARN MORE
Dismiss Notice
NEW Divi.Help Pro Carousel AI Toolkit - Magically turn your Divi design into carousel, simply by using our online toolkit. No plugins needed. Now it works with Divi 5 as well!Try our carousel AI toolkit
BEST Divi Block - A revolutionary drag & drop tool to easily mix & match 960+ premade blocks (Light & Dark) to kick start your Divi site design. Special module designs are included as well. Also newly added AI generator & color. Now it works with Divi 5 as well!
Learn More About Divi BlockFree Version ~ 340+ Free Blocks

Solved ADA Compliance HELP

Discussion in 'Free Divi Community Forum' started by Brett Gillan, Feb 27, 2023.

  1. Brett Gillan

    Brett Gillan New Member

    I am trying to make my website ADA compliant via https://www.accessibilitychecker.org/audit/?website=creativets.org&flag=us and have two issues left to solve.

    1) "Fullwidth Slider Settings" - Need to add a "title element" to the "previous" and "next" arrows.
    • title = "previous" - title = "next"

    2) "Disable Zoom Function" in this section of the <head>.
    • <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    I have not been able to locate the files that create these elements. Any help would be greatly appreciated! Thanks!
     
    1. PRO MEMBER PERKS Divi Powerful Child Theme - Power up your Divi sites with tons of new functionalities & premade elements:Learn More
  2. Problemizer.com

    Problemizer.com Divi Expert

    Hello Brett,

    For the first issue, let's try adding this JavaScript code and then test if it solves the issue. Go to Divi -> Theme Options -> Integration -> Add code to the < head > of your blog;
    HTML:
    <script>
        window.addEventListener('DOMContentLoaded', (event) => {
            const prevArrowIcon = document.getElementsByClassName("et-pb-arrow-prev")[0]
            prevArrowIcon.setAttribute("title", "previous");
            const nextArrowIcon = document.getElementsByClassName("et-pb-arrow-next")[0]
            nextArrowIcon.setAttribute("title", "next");
        });
    </script>
    Let me know if this worked.
     
  3. Brett Gillan

    Brett Gillan New Member

    Thanks so much for the response!

    I keep getting an error on "setAttribute": Uncaught TypeError: Cannot read properties of undefined (reading 'setAttribute')

    I tried a few things to troubleshoot:
    document.addEventListener
    addAttribute
    I even tried putting the script in the body.

    Somehow it's not finding the class. Is there a good "alert" I could use to make sure prevArrowIcon is being populated? prevArrowIcon is showing as undefined...prevArrowIcon.length isn't showing.
     
    1. PRO MEMBER PERKS Divi Block Pro - Premade card carousel design for your Divi site without using any plugins:View Demo
  4. Problemizer.com

    Problemizer.com Divi Expert

    Please try the following code. I tested this one and it is working:

    HTML:
    <script>
        function setArrowTitles() {
      let prevArrowIcon = document.getElementsByClassName("et-pb-arrow-prev")[0];
      let nextArrowIcon = document.getElementsByClassName("et-pb-arrow-next")[0];
    
      if (prevArrowIcon && nextArrowIcon) {
        prevArrowIcon.setAttribute("title", "previous");
        nextArrowIcon.setAttribute("title", "next");
      } else {
        setTimeout(setArrowTitles, 100);
      }
    }
    
    window.addEventListener('DOMContentLoaded', setArrowTitles);
    
    </script>
     
  5. Brett Gillan

    Brett Gillan New Member

    You got it!! That worked! Thanks so much!
     
    1. PRO MEMBER PERKS Divi.Help Pro Layout Packs - Beautifully crafted Divi layout packs for you to kick start your Divi sites:View Demo
  6. Problemizer.com

    Problemizer.com Divi Expert

    Hey Brett,

    The code works but I checked further and you shouldn't rely just on the title attributes because they will not be picked by most screen readers.

    If you are really concerned about accessibly, then modify the code to something like this


    HTML:
    <script>
        function setArrowTitles() {
          let prevArrowIcon = document.getElementsByClassName("et-pb-arrow-prev")[0];
          let nextArrowIcon = document.getElementsByClassName("et-pb-arrow-next")[0];
    
          if (prevArrowIcon && nextArrowIcon) {
            prevArrowIcon.setAttribute("aria-label", "Previous Slide");
            prevArrowIcon.setAttribute("title", "previous");
            nextArrowIcon.setAttribute("aria-label", "Next Slide");
            nextArrowIcon.setAttribute("title", "next");
          } else {
            setTimeout(setArrowTitles, 100);
          }
        }
    
        window.addEventListener('DOMContentLoaded', setArrowTitles);
    </script>