# Image lightbox not working after collapsed

**URL:** https://meta.discourse.org/t/image-lightbox-not-working-after-collapsed/214727
**Category:** Bug
**Tags:** chat
**Created:** [January 13, 2022, 7:39am UTC](https://meta.discourse.org/t/image-lightbox-not-working-after-collapsed/214727 "2022-01-13T07:39:50Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Don](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/don/32/228726_2.png) [@Don](https://meta.discourse.org/u/Don)
#### Post date: [January 13, 2022, 7:39am UTC](https://meta.discourse.org/t/image-lightbox-not-working-after-collapsed/214727/1 "2022-01-13T07:39:50Z")

</div>

Hello,

The image in chat expanded by default and I can open in lightbox but If I collapse and expand again the lightbox will not work.

Repro:

1. Collapse an image
2. Expand it again
3. Lightbox will not work anymore

Thanks 🙂

---

<div class="post-metadata">

### Author: ![nat](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nat/32/235063_2.png) [@nat](https://meta.discourse.org/u/nat)
#### Post date: [January 18, 2022, 6:29am UTC](https://meta.discourse.org/t/image-lightbox-not-working-after-collapsed/214727/5 "2022-01-18T06:29:18Z")

</div>

Thanks for the great report, super easy to reproduce! It is now confirmed to be fixed: [PR](https://github.com/discourse/discourse-chat/pull/528). We’ll have to give it some time to be propagated to meta.

---

<div class="post-metadata">

### Author: ![Don](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/don/32/228726_2.png) [@Don](https://meta.discourse.org/u/Don)
#### Post date: [March 16, 2023, 6:59pm UTC](https://meta.discourse.org/t/image-lightbox-not-working-after-collapsed/214727/7 "2023-03-16T18:59:55Z")

</div>

Hello,

It seems this issue happens again. 🙂

> [@Image lightbox not working after collapsed](https://meta.discourse.org/t/image-lightbox-not-working-after-collapsed/214727):
>
> Hello, The image in chat expanded by default and I can open in lightbox but If I collapse and expand again the lightbox will not work. Repro: Collapse an image Expand it again Lightbox will not work anymore Thanks slightly_smiling_face

Thank you 🙂

---

<div class="post-metadata">

### Author: ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)
#### Post date: [March 17, 2023, 4:26pm UTC](https://meta.discourse.org/t/image-lightbox-not-working-after-collapsed/214727/8 "2023-03-17T16:26:22Z")

</div>

Yes I know what is happening, will fix it now 👍

---

<div class="post-metadata">

### Author: ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)
#### Post date: [March 17, 2023, 5:27pm UTC](https://meta.discourse.org/t/image-lightbox-not-working-after-collapsed/214727/9 "2023-03-17T17:27:00Z")

</div>

That should fix it:

> <https://github.com/discourse/discourse/pull/20724>
>
> Prior to this fix, the upload was removed from DOM when collapsed and not decora…ted again on expand, which was causing lightbox to not get reapplied. The fix is reverting to previous state where content was not removed from DOM.

Thanks

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [April 15, 2023, 11:47am UTC](https://meta.discourse.org/t/image-lightbox-not-working-after-collapsed/214727/11 "2023-04-15T11:47:43Z")

</div>


