Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #1485492

    I would like to hide the wording/label that appears when you mouse-over an icon.
    I have some Icons displayed. One of them is an icon of a map. When one mouses-over it, the label “map” appears.

    I’ve tried this style in my style sheet, but no change:
    .data-av_svg_icon, .icon-label {display: none !important;}

    thanks much

    #1485493

    Hey laptophobo,

    Thank you for the inquiry.

    Try to add this filter in the functions.php file to remove the default attributes of the SVG icons:

    add_filter('avf_ignore_svg_aria_attributes', '__return_true');
    

    Let us know the result.

    Best regards,
    Ismael

    #1485494

    Hi Ismael,

    That functions.php edit didn’t work for me. to be sure we’re on the same page here, please see this image link: http://dev.websitebrew.com/wp-content/uploads/2025/06/map-label.jpg

    #1485532

    i use for title attributes on links, images etc. this function in my child-theme functions.php:

    function temporary_removal_title_tags(){
    ?>
    <script>
      window.onload = function() {
        var elementsWithTitle = document.querySelectorAll('a, img, *[title]');
        for (var i = 0; i < elementsWithTitle.length; i++) {
            var element = elementsWithTitle[i];
    
            element.setAttribute("data-original-title", element.title);
    
            element.addEventListener("mouseenter", function() {
                this.title = ""; 
            });
    
            element.addEventListener("mouseleave", function() {
                this.title = this.getAttribute("data-original-title"); 
            });
    
            element.addEventListener("mousedown", function() {
                this.title = this.getAttribute("data-original-title");
            });
        }
      };
    </script>
    <?php
    }
    add_action('wp_footer', 'temporary_removal_title_tags');

    BUT this will not influence the <title> inside the xml code of a svg file!

    you can get rid of those <title> but i do not know a way to get them back by mouseleave or mousedown event:
    the code above with a little addon – so use instead:

    function temporary_removal_title_tags_and_get_rid_of_svg_titles(){
    ?>
    <script>
      window.onload = function() {
          var elementsWithTitle = document.querySelectorAll('a, img, *[title]');
    
          for (var i = 0; i < elementsWithTitle.length; i++) {
              var element = elementsWithTitle[i];
    
              element.addEventListener("mouseenter", function() {
                  if (this.title) { 
                      this.setAttribute("data-original-title", this.title);
                      this.title = ""; 
                  }
              });
    
              element.addEventListener("mouseleave", function() {
                  var storedTooltip = this.getAttribute("data-original-title");
                  if (storedTooltip !== null) { // Prüfen, ob ein Originaltitel gespeichert wurde
                      this.title = storedTooltip;
                      this.removeAttribute("data-original-title"); // Aufräumen
                  }
              });
    
              element.addEventListener("mousedown", function() {
                  var storedTooltip = this.getAttribute("data-original-title");
                  if (storedTooltip !== null) {
                      this.title = storedTooltip;
                      this.removeAttribute("data-original-title");
                  }
              });
          }
    
          var allSvgs = document.querySelectorAll('svg');
          allSvgs.forEach(function(svg) {
              var svgTitles = svg.querySelectorAll('title');
              
              svgTitles.forEach(function(svgTitleElement) {
                  if (svgTitleElement.textContent.trim() !== '') {
                      svgTitleElement.setAttribute("data-original-svg-title", svgTitleElement.textContent);
                      svgTitleElement.textContent = ""; // Leeren des SVG-Titels
                  }
              });
          });
      };
    </script>
    <?php
    }
    add_action('wp_footer', 'temporary_removal_title_tags_and_get_rid_of_svg_titles');

    why not delete all title tags: sometimes these are needed for lightbox bottom bar

    #1485539

    Thanks for that Guenni,
    I hadn’t expected that removing a superfluous icon tag would be so complicated. Having that tag show up is rather confusing to the viewer. Anyway, I’m going to just keep the icon issue as it is. It’s not such a big deal.

    Thanks again!

    #1485541

    Hi,

    The tooltip or icon tag is a default browser feature, and the only way to disable it is by removing the title attribute or tag. The script provided by @Guenni007 and the the filter we shared should take care of that.

    We’ll close the thread for now but if you have more questions, feel free to start another.

    Have a nice day.

    Best regards,
    Ismael

    #1485563

    btw. ismael – I have no success with the filter either:

    #1485565

    Hi,


    @Guenni007
    : Looks like the filter is intended only for the ARIA attributes of the SVG logo.

    Best regards,
    Ismael

    #1485568

    Thanks guys for trying. We can close this now.

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.