SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Enthusiast mohammedsk's Avatar
    Join Date
    Nov 2005
    Location
    Columbia, Missouri
    Posts
    99
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Hide Hyperlink Focus

    Is there a way to hide the link focus onmousedown using JavaScript or CSS? Specially in Firefox.


    Thanks,

  2. #2
    CSS & JS/DOM Adept bronze trophy
    Join Date
    Mar 2005
    Location
    USA
    Posts
    5,482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes... Why would you want to disable an accessibility feature that your users may rely on?
    We miss you, Dan Schulz.
    Learn CSS. | X/HTML Validator | CSS validator
    Dynamic Site Solutions
    Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.

  3. #3
    SitePoint Evangelist vikrantkorde's Avatar
    Join Date
    Jun 2004
    Location
    Mumbai, India
    Posts
    541
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can you please give some more details exactly what you are asking for....
    Vikrant Korde
    S Y S T I M E, Mhape,
    Mumbai, Maharashtra, India.

  4. #4
    SitePoint Evangelist
    Join Date
    Mar 2006
    Location
    Sweden
    Posts
    451
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    var links = document.getElementsByTagName( 'a' );
    for( var i = 0, l = links.length; i < l; i++ )
    {
        links[i].onfocus = function() { this.blur(); }
    }
    But as said, you make your site less accessible by doing it.

  5. #5
    SitePoint Enthusiast mohammedsk's Avatar
    Join Date
    Nov 2005
    Location
    Columbia, Missouri
    Posts
    99
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, the only reason I wanted to hide the focus is because I have created CSS tabs, the tabs are 160x40px, but when the user clicks on the tab, the focus covers an area of 160x60, it just looks annoying.


    Thanks for the help.

  6. #6
    CSS & JS/DOM Adept bronze trophy
    Join Date
    Mar 2005
    Location
    USA
    Posts
    5,482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There is a better way. Using blur() to do it disables keyboard navigation which is an extremely bad idea.

    Make sure that the links have a :focus state defined and then you can use this:
    Code:
    #nav a {
      outline: 0 none;
    }
    We miss you, Dan Schulz.
    Learn CSS. | X/HTML Validator | CSS validator
    Dynamic Site Solutions
    Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •