# \[ISSUE\]? why are some of the dashboard buttons in the foreground?

**URL:** https://discourse.nodered.org/t/issue-why-are-some-of-the-dashboard-buttons-in-the-foreground/20482
**Category:** Dashboard
**Created:** [17 January 2020 08:32 UTC](https://discourse.nodered.org/t/issue-why-are-some-of-the-dashboard-buttons-in-the-foreground/20482 "2020-01-17T08:32:18Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![SuperNinja](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/superninja/32/5761_2.png) [@SuperNinja](https://discourse.nodered.org/u/SuperNinja)
#### Post date: [17 January 2020 08:32 UTC](https://discourse.nodered.org/t/issue-why-are-some-of-the-dashboard-buttons-in-the-foreground/20482/1 "2020-01-17T08:32:18Z")

</div>

**This is the dashboard :**

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/6/3638e65d434edc5d6c68e672bd0a578cf258ea9a.png)

**I clic on the picture to enlarge** ( it's a UI\_template node with this html code : [https://www.w3schools.com/howto/howto\_css\_modal\_images.asp](https://www.w3schools.com/howto/howto_css_modal_images.asp)) :

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/6/b6d7d4dfd840d6516afdc33103a8c4ee3eaf6bb5.jpeg)

**Why some buttons are in second layer while other are in first layer ?**

Help is appreciate, thanks

Chris

---

<div class="post-metadata">

### Author: ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)
#### Post date: [17 January 2020 08:55 UTC](https://discourse.nodered.org/t/issue-why-are-some-of-the-dashboard-buttons-in-the-foreground/20482/2 "2020-01-17T08:55:50Z")

</div>

If you use that actual code as shown in the link, try modifying the css:

```auto
.modal {
...
z-index: 1

```

to:

```auto
z-index: 100

```

If that doesn't work, you need to determine what the z-index of the buttons are (right click on one -\> inspect element and check the properties), the modal should have a higher z-index to cover them.

---

<div class="post-metadata">

### Author: ![SuperNinja](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/superninja/32/5761_2.png) [@SuperNinja](https://discourse.nodered.org/u/SuperNinja)
#### Post date: [17 January 2020 08:59 UTC](https://discourse.nodered.org/t/issue-why-are-some-of-the-dashboard-buttons-in-the-foreground/20482/3 "2020-01-17T08:59:32Z")

</div>

yeah ! very good :

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/7/9781e4c426a977b68fb1c7856ebcf4cb8bfcf85e.jpeg)  
Thanks @bakman2

---

<div class="post-metadata">

### Author: ![SuperNinja](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/superninja/32/5761_2.png) [@SuperNinja](https://discourse.nodered.org/u/SuperNinja)
#### Post date: [17 January 2020 09:08 UTC](https://discourse.nodered.org/t/issue-why-are-some-of-the-dashboard-buttons-in-the-foreground/20482/4 "2020-01-17T09:08:24Z")

</div>

One last question @bakman2 : I would like to close this "enlarged image" window by clicking outside the image (in the black part), and not just on the cross. What would be the code to add to close the modal?

---

<div class="post-metadata">

### Author: ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)
#### Post date: [17 January 2020 09:13 UTC](https://discourse.nodered.org/t/issue-why-are-some-of-the-dashboard-buttons-in-the-foreground/20482/5 "2020-01-17T09:13:15Z")

</div>

You could try to add this to the javascript:

```auto
modal.onclick = function() { 
  modal.style.display = "none";
}

```

---

<div class="post-metadata">

### Author: ![SuperNinja](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/superninja/32/5761_2.png) [@SuperNinja](https://discourse.nodered.org/u/SuperNinja)
#### Post date: [17 January 2020 09:24 UTC](https://discourse.nodered.org/t/issue-why-are-some-of-the-dashboard-buttons-in-the-foreground/20482/6 "2020-01-17T09:24:18Z")

</div>

whoow : nice !! Is it possible that the click is active only outside the image as in this example [https://www.w3schools.com/w3css/tryit.asp?filename=tryw3css\_modal\_close](https://www.w3schools.com/w3css/tryit.asp?filename=tryw3css_modal_close)  
and it will be perfect 🙂

---

<div class="post-metadata">

### Author: ![SuperNinja](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/superninja/32/5761_2.png) [@SuperNinja](https://discourse.nodered.org/u/SuperNinja)
#### Post date: [17 January 2020 09:27 UTC](https://discourse.nodered.org/t/issue-why-are-some-of-the-dashboard-buttons-in-the-foreground/20482/7 "2020-01-17T09:27:10Z")

</div>

i found :

```auto
// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
  if (event.target == modal) {
    modal.style.display = "none";
  }
}

```

It's ok thanks @bakman2
