Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8421359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T03:07:51+00:00 2026-06-10T03:07:51+00:00

A third party script is being used on a site I work on that

  • 0

A third party script is being used on a site I work on that replaces a few instances of <a href=""> with <a>. The links still work thanks to another part of the script, but they are no longer treated as links by user agents.

I can restore them to the tabbed navigation order by adding tabindex="0" but how can I make assistive technologies announce them as links or include them in a list of all links on a page?

Would adding role="link" help at all?

I am pushing the third party to improve their script so that the href is left intact. But in the meantime how do I best repair the damage that’s being done?

I can’t add either the original href or something like href="#" back to the links as the third party code will no longer do what it does. I hope that they improve their code so that I can, but for now I need to make the link accessible without the ‘href’.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T03:07:53+00:00Added an answer on June 10, 2026 at 3:07 am

    To make a non-href <a> behave like an <a> (and be accessible), you’d have to add role=link, tabindex=0, style it to look like a real link, and add keyboard handler code to treat Return as a click.

    role="link" isn’t sufficient; a screenreader may report it as a link, but without tabindex="0" and appropriate visual styles, a sighted user won’t be able to tab to it in the first place, and without a keyboard event handler, only mouse users will be able to click it. (Technically screenreader users typically have hotkeys to simulate a mouse click, but keyboard-only sighted users generally don’t have that option, so don’t rely on it.)

    Alternatively, if (big if!) the crazy script you’re using allows for it, you could try shimming a ‘keyboard click source’ (my terminology) <a> just inside the original one: so where you have:

    <a>foo</a>
    

    you replace it with:

    <a><a class='shim' href="javascript:void(0)">foo</a></a>
    

    (The class='shim' is only needed if you need to do the event stuff described later…)
    You can do this in jQuery using something like: (borrowing from Jack’s answer)

    $("a:not([href])").wrapInner("<a class='shim' href='javascript:void(0)'></a>")
    

    How this works is that the inner newly-added <a ...> has a href, so it is exposed as a link and is tabbable. More importantly, if a user tabs to it and presses return, the default A behavior converts that keyboard input into a click event. This specific A has a href that returns undefined/void(0), so no actual navigation happens, but the click event will still bubble up to the original A, which gets to act on it.

    (This is a neat pattern for allowing some parent element – often a DIV or similar – to handle click events, adding a child tabbable A that can source click events from keyboard gives you UI that’s both mouse and keyboard usable.)

    The big caveat here is that it assumes that your original script doesn’t care about the target of the event. If that script does check this, it will get confused when it sees click events coming from the shim A’s rather than the original As. One way to get around this is to capture and re-raise the event, which can be fiddly, and may only work on recent browsers – eg using something like:

    // 'shim' class used so we can do this:
    $("a.shim").click(function(e) {
        e.preventDefault();
        e.stopPropagation();
    
        // the following works if listener using jQuery or is setting onclick directly, otherwise...
        // $(e.target).parent().click();.
    
        // More general way to raise events; may need alternate for IE<9
        var e2 = document.createEvent("UIEvents");
        e2.initUIEvent("click", true, true, window, 1);
        e.target.parentNode.dispatchEvent(e2)
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When a page includes third party javascript (via <script src=... ) and that javascript
I'm writing a Groovy script which uses third party java code that I can't
I have a PHP script that syncs data with a third party service, and
I have this odd problem with a third party script. On our site a
I have an image map that uses a third party script(mapper.netzgesta.de) to highlight the
I have a third party script that is including jquery (which causes things to
I'm loading third party webpage that contains following code <script type=text/javascript> onDomReady(function() { some_code1;
I have a third-party Python script (foo.py) in a folder that is in my
I am trying to improve a script that contains a third-party Delphi tree of
I am trying to use a third party script and extract the logged in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.