Viewing 16 posts - 1 through 16 (of 16 total)
  • Author
    Posts
  • #1222813

    Hi,

    In the Masonry Gallery (Perfect Grid) page it shows the thumbnails, the images that when clicked open in a lightbox. When the page is checked for accessibility compliance, there is an error notice saying “Empty link: a link contains no text” on each image.
    Since those images are scaled automatically by the masonry script from the original, no alt text can be used on them (as the image is a background image in the lightbox).

    But the gallery styling gives the possibility to display:
    – Display Title and Excerpt (<<<< Excerpt is actually the Caption, you may want to change that in the code for clarity)
    – Display Title
    – Display Excerpt (<<<< Excerpt is actually the Caption, you may want to change that in the code for clarity)
    – Display neither

    Next under “Element Title and Excerpt display settings” you can choose when to display Title and/or Excerpt:
    it gives you the option when to show it or hide it:
    – Always display
    – Display on mouse hover
    – Hide on mouse hover

    Note: the explanation description is not correct, should be something like “You can choose whether to always display, only on hover or hide on hover”

    Now for my real question:
    Since showing the image Title or entering the image Caption (your “Excerpt”) gets rid of the accessibility warning about the Empty Link, I was wondering if it would be possible to have a fourth option in “When to Display” that offers the same as “show on mouse hover” or “display as centered overlay” but without actually showing it on mouse hover or as overlay? Something like “Use invisibly”?
    That way the title would be there as the link text for accessibility reasons but doesn’t actually display.
    “Display neither” is obviously not an option, then it just disappears from the code, resulting in the Empty Link error.

    Is this something that would be doable using the .av-masonry-entry-content which shows on hover or in centered overlay, or would that create problems elsewhere?
    Added remark 2020-06-17:
    Or even simpler, would it be possible to always have the image title set as the link text regardless of the other options chosen?

    Thanks in advance,
    Rob

    • This topic was modified 4 years, 5 months ago by rob2701. Reason: Added remark for possible simpler solution
    #1224458

    Hey Rob,
    Sorry for the late reply, as I understand your issue, the Masonry Gallery is getting an error notice saying “Empty link: a link contains no text” on each image from an accessibility compliance test.
    In my test I found if you can use “Display neither” for the caption and enter the title for each image and it will show as a “title” attribute on the link and the background image container.

    So to enter the titles, edit your Masonry Gallery element and “edit the gallery” then click on each image to add the titles.
    edit_title_gallery_image.png
    Here you can see the title attributes:
    2020-06-21_192507.png
    Please try this and let us know if it passes your accessibility compliance test.

    Best regards,
    Mike

    #1224482

    Hi Mike,

    Thanks for looking into this. Yes, that is the exact error from the WAVE tool: “Empty Link: A link contains no text” on the masonry gallery image links (the thumbnails with links to the lightbox).

    What you suggest is actually what I already have: each image automatically has the filaneme as title.
    Yet in my setup the accessibility compliance test still shows empty link. So there must be something else different in my setup than in your testing environment.

    What’s different in my setup is that I have in my functions.php code to hide the tooltip on the images on hover:

    // Hide image filename (alt text) displaying on hover
    // NOTE: this ALSO removes the ability to use TITLES (="captions") in the lightbox galleries!
    // Added query to also remove title on hover in portfolio galleries
    function remove_title_attr(){
    ?>
     <script>
    jQuery(window).load(function(){
    jQuery('#wrap_all a').removeAttr('title');
    jQuery('#wrap_all img').removeAttr('title');
    jQuery('.av-masonry-image-container').removeAttr('title');
    });
     </script>
    <?php
    }
    add_action('wp_footer', 'remove_title_attr');

    I thought that may have been interfering, but removing it makes no difference.
    The empty link error only disappears when I set the masonry gallery images to “Display Title”, but that is not how I want it: I like the clean image only look. Plus, I use the image filename as the title (and there is no way I am going to manually enter different titles in the media library manually for all since I don’t use them anyway), resulting in a “Redundant title text” error. So that’s two reasons why I cannot use that.

    Can you take a look? Details in private field.

    Related issue is (on the Galleries overview page which links to all individual masonry galleries) both the featured image and the title of the gallery are a link, resulting in the accessibility alert “redundant links: adjacent links go to the same URL”.
    You can see this on the “Impressions” Portfolio grid.

    Is there a way to either unite both links (featured image and title) or if that cannot be done to effectively hide the title links programmatically?

    Thanks for your help and time,
    Rob

    #1224583

    Hi,
    Your script to remove the title attributes “on hover” is actually just removing the title attributes on page load and thus causing your “Empty Link” error. Please remove this script and test.
    After testing to ensure this error is corrected, if you want to remove the title attributes “on hover” then try this script instead:

      function remove_title_attr_on_hover(){
    	?>
    	 <script>
    	(function($){
    	  $(".av-masonry-image-container").hover(function(){
    		$(this).removeAttr("title");
    	  });
    		$("#wrap_all img").hover(function(){
    		$(this).removeAttr("title");
    	  });  
    	   $("#wrap_all a").hover(function(){
    		$(this).removeAttr("title");
    	  });    
    	})(jQuery);
    	 </script>
    	<?php
    	}
    	add_action('wp_footer', 'remove_title_attr_on_hover');

    Best regards,
    Mike

    #1224605

    Hi Mike,

    I tried out the script you gave me instead of the one I had, and it does not make a difference. I had already tried to remove that entire code from the functions.php (like I mentioned earlier above) to find out if that was the culprit, but it did not resolve the issue. Like you said, with the “hide filename on hover” scripts removed the image titles are nicely visible in the code (without the script), as below:

    <a href="http://site.com/wp-content/uploads/impressions-01-2133x1600-q10.jpg" id="av-masonry-1-item-7105" data-av-masonry-item="7105" class="av-masonry-entry isotope-item post-7105 attachment type-attachment status-inherit hentry av-masonry-item-with-image lightbox-added av-masonry-item-loaded" title="impressions-01-2133×1600-q10" itemprop="thumbnailUrl" style="position: absolute; left: 0%; top: 0px;"><div class="av-inner-masonry-sizer"><figure class="av-inner-masonry main_color"><div class="av-masonry-outerimage-container"><div class="av-masonry-image-container" style="background-image: url(https://site.com/wp-content/uploads/impressions-01-2133x1600-q10.jpg);" title="impressions-01-2133×1600-q10"></div></figure></a>
    <!-- end av-masonry entry-->

    With my script or with your script to remove the tooltips on hover present the image title does not show in the code.

    But it looks like we are talking about two different things here. The image Title is not the problem, it is the link itself which has no text, so the part just before the closing :
    <a href="blablabla" ... </div></figure>---<THERE IS NO LINK TEXT HERE>---</a>

    So how can we solve that?

    As for the second issue of duplicate links (on the Galleries overview page which links to all individual masonry galleries, where both the featured image and the title of the gallery point to the same URL):

    Is there a way to either unite both links (featured-image and title) inside a div or something and put the link on that, or if that cannot be done to effectively hide the title links programmatically? Thanks for your help.

    Regards,
    Rob

    • This reply was modified 4 years, 5 months ago by rob2701. Reason: corrected typos
    #1224859

    Hi,
    I tested our masonry gallery demo page on the Wave tool but I only got alerts for “Null or empty alternative text” but no “Empty Link” errors even though they are empty. Yet your page does get this error for the same layout?

    According to this solution, we should be able add an aria-label attribute to the <a> element instead of adding text.

    Best regards,
    Mike

    #1224889

    Hi Mike,

    Indeed on the 3column perfect grid portfolio on the demo there are no empty link errors.

    I have just done a little testing, and the difference is in the Captions Display settings in the masonry gallery.
    When I set Captions to “Display Title/Bottom/AlwaysDisplay” (like in the demo) I don’t get any empty link text errors either.
    I have done this on the first gallery on the dev site, check it out there.
    Problem is: I do NOT want the Titles displaying below the thumbs (as they are simply the filenames).
    So the issue remains…

    And what about the second issue I mentioned on the galleries overview page (duplicate links on the Galleries overview page which links to all individual masonry galleries, where both the featured image and the title of the gallery point to the same URL)?

    Regards,
    Rob

    Added info:
    I can’t hide the titles when set to display through CSS either, because the space remains even if they don’t show:

    /* hide image titles in masonry galleries - even if set to display */
    h3.av-masonry-entry-title {
    display: none;
    }

    In an “ideal” world, the link text would go something like “Open image <insert-image-number> in lightbox”
    Just my 2 cents :-)

    • This reply was modified 4 years, 5 months ago by rob2701. Reason: added my 2 cents for image link text
    #1225152

    Hi,
    To hide the title from showing over the masonry image, the way you have it right now, try this css:

    .av-masonry-entry figcaption.av-inner-masonry-content.site-background {
    	display: none;
    }

    But please check the demo page I linked to above, the title doesn’t show over the masonry image and it doesn’t get the empty link error. I’m using the Wave Chrome extension, do you see the same?

    Your galleries overview page /impressions/ is using a portfolio grid element, so it a different element and issue, so lets work on one at a time.

    Best regards,
    Mike

    #1225160

    Hi Mike,

    Thank you for your patience in working through this, I understand it’s not always easy to assess all different layout setups people can have with Enfold and all the modifications they apply :-)

    Your new CSS to hide the title from showing over the masonry image works perfectly, so that is good workaround for me for now. I just need to set all masonry galleries to “always show title” and then hide them through CSS, then the “empty link text” WAVE error doesn’t appear anymore. So thanks for that, one issue tackled.

    Still, since this is a bit convoluted as a procedure (set to show Titles and then hide them anyway), could I ask you to submit a fix request/feature request for the things we encountered during these tests? I noticed that particpants cannot do that themselves anymore. So could you please forward this as a feature/fix request? Thanks!

    Re: Masonry Gallery perfect grid
    1)
    Link text should not be affected by the option Display Neither, which is now the case. If I choose that option in the Masonry Settings, WAVE errors about empty link text appear. Ideally link text should be something like “Open <image-number-in-gallery> in lightbox”, regardless of other options set.
    2)
    Duplicate links in the Galleries overview page (grid masonry category) (on image and Title) should be solved by uniting them in a container and then setting one link on the container. That way the links are independent of other options chosen.
    3)
    Some improvements could be made to the interface of the masonry gallery:
    – the gallery styling gives the possibility to display:
    – Display Title and Excerpt
    – Display Excerpt
    but: >>> Excerpt is actually the image Caption — please change that for clarity
    – under “Element Title and “Excerpt”(= Caption) display settings”:
    – the explanation description is not correct, should be something like
    “You can choose whether to always display, display only on hover, or hide on hover”

    Thanks for the good workaround for the “empty link text” error, I would not have found that all by myself.
    BTW, I use the WAVE extension too (in Chrome and in Firefox).

    Thanks for all the help,
    Rob

    • This reply was modified 4 years, 5 months ago by rob2701. Reason: typo correction
    #1225807

    Hi,
    Thanks for the update, and I’m glad this helped some, and I will be submitting this to the dev team, but I need to sort out a couple of things.
    So on a new install, I tried to duplicate your masonry element, with portfolio items and using the settings you described.
    Please see the page in the Private Content area.
    So with no caption showing, to solve the empty link error I wrote this script to get the masonry item title attribute and add it as an aria-label attribute. This allows the link to be empty and removes the error.
    This script was added in a code block section on the page to test:

    <script>
    (function($){
      $(document).ready(function(){
      	imgTitle = $(this).attr("title");
    $( '.av-masonry' ).each(function() {
    $( this ).find( 'a.av-masonry-entry' ).attr("aria-label", imgTitle);
    });
    });
    })(jQuery);
    </script>

    So perhaps if the caption display setting is set to “Display neither” the aria-label could be added, or it could always be included.

    For the duplicate titles, this error is not exactly “duplicate titles” it was the “title” and the caption “text” were the same, so in the past post when I added “titles” to the images in the media library this made the two not match anymore so the error didn’t occur, but I notice with this script that this is also solved without adding media library titles.

    Thoughts?

    Best regards,
    Mike

    #1225847

    Hi Mike,

    Once again, thank you for your patience and help in sorting through this. Please feel free to test things out on the dev site provided, it’s a copy and well backed-up. I have added your script in a code block on both the T and the I page. Then I set the first portfolio item in the I page to “Display Neither”. Nice solution! This seems to properly take care of the WAVE errors. You can see it on the dev site. I also added the code block with script to that first “I” portfolio item, and it works well there too! Great!

    Regarding the second issue, that was about duplicate links, on the page with the overview of the T/I (so the Portfolio Category pages, grid) and on the Portfolio items themselves when opened. There the same links are set (independently) on both the featured image and the Portfolio Item Title, resp. the masonry created preview img and the (invisible) title. Resulting in the WAVE tool alert about Redundant Links. I feel (but please correct me if I’m wrong) that it would be better to set the one link on the container, so it would be independent of whether titles/images are shown., That was a stupid suggestion by me, as that is already the case :-)
    Seems the masonry entry ID needs to be targeted for that. Sorry for the confusion!

    Again, I err. The links are not independently set but they show up twice anyway. This must be something in the masonry script. Frankly, I’m out of my depth here, so I’ll stop saying stupid things… :-))

    Just trying to fix the horrible mess I made in the description of the redundant links alerts in the Portfolio Category Page:
    Image link now set on: .grid-image
    Title link now set on: .grid-entry-title entry-title
    could be set on: div.grid-entry:nth-child(1) > article:nth-child(1)
    Sorry for the confusion created!

    Kind regards,
    Rob

    • This reply was modified 4 years, 4 months ago by rob2701. Reason: Just trying to fix the horrible mess I made in the description of the redundant links alerts
    #1226125

    Hi,
    Glad this helped, your site seems down or the login token has expired, please check.
    I think I will understand this issue better once I can check it.

    Best regards,
    Mike

    #1226138

    Hi Mike,

    Sorry, that was my mistake, I had deleted something from the child theme functions.php, but not well enough, left a “\\” in, resulting in the infamous “cookies are blocked” error and white screens. Fixed now.

    Thanks for your continued help!
    Rob

    #1226158

    Hi,
    Thank you, for the T & I pages I came up with this script to help you for now until the dev team can review this.
    Try adding this code to the end of your functions.php file in Appearance > Editor:

    function custom_script(){
      ?>
      <script>
    (function($){
      $(document).ready(function(){
    $( '.grid-sort-container .grid-entry' ).each(function() {
    $( this ).find( 'a.grid-image' ).removeAttr("title").insertBefore( $(this).find('article.inner-entry') );
    $( this ).find( 'article.inner-entry' ).insertAfter( $(this).find('span.image-overlay') );
    $( this ).find( 'h3.grid-entry-title.entry-title a' ).contents().unwrap();
    });
    });
    })(jQuery);
    </script>
    <?php
    }
    add_action('wp_footer', 'custom_script');

    Best regards,
    Mike

    #1226183

    Hi Mike,

    Thanks for this script, that was superquick! I added it and it works brilliantly! All duplicate link alerts are now gone from those two pages. Check it out on the dev site if you want.

    Thanks again for all the help and for your patience. Kudos.

    Kind regards,
    Rob

    #1226232

    Hi,
    Thank you for the feedback, I have submitted a report to the dev team to review, but I’m glad to hear this will help for now.
    We will close this now. Thank you for using Enfold.

    For your information, you can take a look at Enfold documentation here
    For any other questions or issues, feel free to start new threads in the Enfold forum and we will gladly try to help you :)

    Best regards,
    Mike

Viewing 16 posts - 1 through 16 (of 16 total)
  • The topic ‘Advice on accessibility for masonry grid images’ is closed to new replies.