3

I have a set of tabs on my page that when clicked, switch the active tab to the value of the clicked tab. This works swimmingly, but I am left with a sour taste in my mouth when I look at the new active tab having a big blue focus box around it. Is there a React-y way to prevent this?

Would an onMouseDown={this.someMethod} with a preventDefault() stuck in the method work?

2
  • Why would you want to prevent the focus? Don't you want your site to be accessible? If it's just about aesthetics, you can use CSS to change the style. Commented Mar 23, 2016 at 21:11
  • its almost like I want to change the style of the focusing :/ Commented Mar 24, 2016 at 15:13

1 Answer 1

1

The logics are right but the design is making you problems? In that case some CSS should make it right.

If you have a navbar the CSS should be something like this:

 .navbar-inverse .navbar-brand:focus {
  background-color : red; //Just add the properties you want here
}

If you just right click and inspect the element the browser should tell you exactly about what CSS handles the focus on the tab.

Sign up to request clarification or add additional context in comments.

3 Comments

I wanted to be able to not allow the blue focus bordering (on Chrome) when you clicked on a nav item. Because of the spacing, the nav items sit right next to each other and the focus "border" bleeds onto the other nav items
In that case just add the css which handles the focus.
@FredChapman: then set outline: none.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.