# How to stop click in Component from automatically focusing first child

**URL:** <https://forum.juce.com/t/how-to-stop-click-in-component-from-automatically-focusing-first-child/44443>\
**Category:** General JUCE discussion\
**Created:** [February 15, 2021, 11:03pm UTC](https://forum.juce.com/t/how-to-stop-click-in-component-from-automatically-focusing-first-child/44443 "2021-02-15T23:03:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![stephenk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/stephenk/32/15198_2.png) [@stephenk](https://forum.juce.com/u/stephenk)\
**Post date:** [February 15, 2021, 11:03pm UTC](https://forum.juce.com/t/how-to-stop-click-in-component-from-automatically-focusing-first-child/44443/1 "2021-02-15T23:03:02Z")

</div>

I have a main Component with a bunch of child components.

When you click anywhere in the background of the parent, it automatically gives focus (a focus outline) to the first child component. How do you disable this behavior? I’ve tried everything I can think of.

In the main (parent) component constructor, I have tried setting:

```auto
    setWantsKeyboardFocus(false);
    setMouseClickGrabsKeyboardFocus(false);
    setInterceptsMouseClicks(false, false);
    setFocusContainer(false);

```

…and it still automatically focuses the first child component with a click.

---

<div class="post-metadata">

**Author:** ![stephenk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/stephenk/32/15198_2.png) [@stephenk](https://forum.juce.com/u/stephenk)\
**Post date:** [February 16, 2021, 6:51am UTC](https://forum.juce.com/t/how-to-stop-click-in-component-from-automatically-focusing-first-child/44443/2 "2021-02-16T06:51:41Z")

</div>

OK… I think I’m starting to get it. Counter intuitive, but it seems if you want the first child component NOT to be given focus by a click in the parent component, you have to set the parent component to setWantsKeyboardFocus(true) - even if you then do nothing with that focus.
