Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #1413520

    I have used the code in this thread to add skip link to a site. https://kriesi.at/support/topic/accessibility-skip-navigation/
    But how do I get the link to be invisible until you use the tab key?

    Regards
    Nina

    #1413575

    Hey Advantage09,

    Do you want the link only to be visible once it is in focus? Where can we see the link in question?

    Best regards,
    Rikard

    #1413595

    Top left corner of the site.

    #1413630

    Hi,

    Thanks for that. Please try the following in Quick CSS under Enfold->General Styling:

    a.jsf-skip-link {
      display: none;
    }
    
    a.jsf-skip-link:focus {
      display: block;
    }

    Best regards,
    Rikard

    #1413653

    Sorry, did not work. display: none did what it should do, but the link does not appear when you click tab. Remove the css and the link is back.

    Regards
    Nina

    #1413673

    Hi,

    Thank you for the update.

    The following css code should work, but you have to take the link out of the div element.

    .jsf-skip-link {
        opacity: 0;
        font-size: 0;
    }
    
    .jsf-skip-link:focus {
        opacity: 1;
        font-size: inherit;
    }

    Best regards,
    Ismael

    #1413704

    Almost. The link is hidden when you open the page and appears when you click the tab. But there is a black gap at the top of each page, where the skp-link appears. Could this be removed?

    And how can I style it to get it a litle bit bigger? I have tried a few things, but it also makes the black gap bigger and that is not looking good.

    Regards
    Nina

    #1413792

    Hi,

    But there is a black gap at the top of each page, where the skp-link appears. Could this be removed?

    This is why you have to move the skip link out of the div container. The black gap should not appear once the div has been removed.

    To adjust the style of the skip link, edit the css rule above and add your own properties to it.

    .jsf-skip-link:focus {
        opacity: 1;
        font-size: inherit;
    }
    

    Best regards,
    Ismael

    #1413818

    I removed the div yesterday as you mentioned, but the gap is still there and it shouldn’t be. I have tried to change the script that goes with it but it removes it completely.

    function custom_skip_link_script(){
      ?>
      <script>
    (function ($) {
        $(document).ready(function () {
        	$( '<a href="#main_content" class="jsf-button jsf-skip-link">Hopp til innhold</a>' ).insertBefore( '#top' );
            $('<a id="main_content" name="maincontent" tabindex="-1"></a>').insertAfter( '.title_container' );
            $(".jsf-skip-link").click(function(){           
                $("#main_content").focus(); 
            });
        });
    })(jQuery);
    </script>
      <?php
      }
      add_action('wp_footer', 'custom_skip_link_script');

    Everything I try to reference instead of #top just removes it.

    Any suggestions?

    Regards
    Nina

    #1413922

    Hi,

    Thank you for the info.

    Try to set the initial height of the link to zero, then set it back to default on focus.

    .jsf-skip-link {
        opacity: 0;
        font-size: 0;
        height: 0;
    }
    
    .jsf-skip-link:focus {
        opacity: 1;
        font-size: inherit;
        height: 20px;
    }

    If that didn’t work, try to pull the body element 20px upwards initially then bring it back to default when the skip link has been focused.

    .jsf-skip-link + body {
        margin-top: -20px;
    }
    
    .jsf-skip-link:focus + body {
        margin-top: 0;
    }

    Best regards,
    Ismael

    #1413990

    This worked, Thank you!

    Regards
    Nina

    #1414007

    Hi,

    Great, I’m glad that Ismael could help you out. Please let us know if you should need any further help on the topic, or if we can close it.

    Best regards,
    Rikard

    #1414180

    You can close this ticket.

    #1414202

    Hi,

    Thanks for letting us know, we’ll close this thread for now then. Please open a new thread if you should have any further questions or problems.

    Best regards,
    Rikard

Viewing 14 posts - 1 through 14 (of 14 total)
  • The topic ‘Skip link’ is closed to new replies.