# Avoid click when child clicked...?

**URL:** <https://forums.fusetools.com/t/avoid-click-when-child-clicked/618>\
**Category:** How-to Discussions\
**Created:** [September 4, 2015, 2:12pm UTC](https://forums.fusetools.com/t/avoid-click-when-child-clicked/618 "2015-09-04T14:12:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tobiasniva](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/tobiasniva/32/265_2.png) [@tobiasniva](https://forums.fusetools.com/u/tobiasniva)\
**Post date:** [September 4, 2015, 2:12pm UTC](https://forums.fusetools.com/t/avoid-click-when-child-clicked/618/1 "2015-09-04T14:12:12Z")

</div>

Don´t really know how to better explain this…and just wanted to get tips/best practices for how to solve a thing;

I have a DockPanel (looped with ‘Each’) for a list like thingy. In this DockPanel I have a ‘Text’ and an ‘Image’ element. I have a Clicked-tag for this DockPanel…but also has a Clicked-tag within the image-tag contained in this DockPanel…to get image clicks.

Of course, when clicking this image, the Clicked for the DockPanel also fires.

What´s the best way to solve this? Split DockPanel in smaller panels…?

---

<div class="post-metadata">

**Author:** ![Anders\_Lassen](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/anders_lassen/32/522_2.png) [@Anders\_Lassen](https://forums.fusetools.com/u/Anders_Lassen)\
**Post date:** [September 4, 2015, 3:57pm UTC](https://forums.fusetools.com/t/avoid-click-when-child-clicked/618/2 "2015-09-04T15:57:57Z")

</div>

Hi!

In your clicked event for your dock panel, you can check the `data` property on the event argument to see where the event came from:

```auto
function dockpanel_clicked(e)
{
    if (e.data !== data_for_dockpanel) return;

    // handle event
}

```

`data_for_dockpanel` would be the JS object used to generate the dockpanel in data binding, or `module.exports` if this dockpanel is a root thing.

---

<div class="post-metadata">

**Author:** ![Anders\_Lassen](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/anders_lassen/32/522_2.png) [@Anders\_Lassen](https://forums.fusetools.com/u/Anders_Lassen)\
**Post date:** [September 4, 2015, 4:03pm UTC](https://forums.fusetools.com/t/avoid-click-when-child-clicked/618/3 "2015-09-04T16:03:12Z")

</div>

This feature is rolling out soon which will make it even easier:

```auto
<DockPanel ux:Name="dock1" Clicked="{clicked}">

```

And in JS:

```auto
function clicked(e)
{
    if (e.sender !== "dock1") return;

    // handle event
}

```

Not yet released as of v0.5.3715, but coming in a near future release 🙂

---

<div class="post-metadata">

**Author:** ![tobiasniva](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/tobiasniva/32/265_2.png) [@tobiasniva](https://forums.fusetools.com/u/tobiasniva)\
**Post date:** [September 6, 2015, 2:06pm UTC](https://forums.fusetools.com/t/avoid-click-when-child-clicked/618/4 "2015-09-06T14:06:30Z")

</div>

Thanx for the tip/explanation. I ended up having the second click-handler on the text instead…I managed to get the clickable area as large as I wanted by tweaking some padding (not just firing at the actual text/label). But anyways, thanx.
