# Lightboxed images with giant filenames cause horizontal scroll

**URL:** https://meta.discourse.org/t/lightboxed-images-with-giant-filenames-cause-horizontal-scroll/33346
**Category:** Bug
**Created:** [2015年九月16日 10:41 UTC](https://meta.discourse.org/t/lightboxed-images-with-giant-filenames-cause-horizontal-scroll/33346 "2015-09-16T10:41:24Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Fabio\_Machado\_de\_Oli](https://avatars.discourse-cdn.com/v4/letter/f/48db29/32.png) [@Fabio\_Machado\_de\_Oli](https://meta.discourse.org/u/Fabio_Machado_de_Oli)
#### Post date: [2015年九月12日 21:07 UTC](https://meta.discourse.org/t/lightboxed-images-with-giant-filenames-cause-horizontal-scroll/33346/1 "2015-09-12T21:07:20Z")

</div>

I am using a recent version now, and I have an horizontal scroll browsing with my galaxy s3.

I have an adsense plugin with all slots turned off, and the tagging plugin. This is an affected topic: [http://www.noiapapps.com/t/ball-run-away-simply-zigzag-ball-game/8292](http://www.noiapapps.com/t/ball-run-away-simply-zigzag-ball-game/8292)

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [2015年九月12日 22:37 UTC](https://meta.discourse.org/t/lightboxed-images-with-giant-filenames-cause-horizontal-scroll/33346/2 "2015-09-12T22:37:20Z")

</div>

That’s kind of weird. It seems to have to do with the first image having a very long filename.

```html
<div class="lightbox-wrapper"><a href="https://lh3.googleusercontent.com/r16HftyROFLrFjWHegf-YnV4wfk63_1CdUfzlSiflHn3SDewY2vZtzfQdan1zuVYmHc=h900-rw" class="lightbox" title="r16HftyROFLrFjWHegf-YnV4wfk63_1CdUfzlSiflHn3SDewY2vZtzfQdan1zuVYmHc=h900-rw"><img src="https://lh3.googleusercontent.com/r16HftyROFLrFjWHegf-YnV4wfk63_1CdUfzlSiflHn3SDewY2vZtzfQdan1zuVYmHc=h900-rw" alt="Ball run away screenshot" width="340" height="454"><div class="meta">
<span class="filename">r16HftyROFLrFjWHegf-YnV4wfk63_1CdUfzlSiflHn3SDewY2vZtzfQdan1zuVYmHc=h900-rw</span><span class="informations">536x716</span><span class="expand"></span>
</div></a></div>

```

If you reduce the length of the filename in `<span class="filename">` the horizontal scrolling goes away. I tried adding a whole bunch of letters to the filename from a lightboxed image in this topic and got the same behaviour.

---

<div class="post-metadata">

### Author: ![Fabio\_Machado\_de\_Oli](https://avatars.discourse-cdn.com/v4/letter/f/48db29/32.png) [@Fabio\_Machado\_de\_Oli](https://meta.discourse.org/u/Fabio_Machado_de_Oli)
#### Post date: [2015年九月15日 15:39 UTC](https://meta.discourse.org/t/lightboxed-images-with-giant-filenames-cause-horizontal-scroll/33346/3 "2015-09-15T15:39:26Z")

</div>

@sam @zogstrip my bug report got confusing because of that webp issue, let me try to explain it better.

When the markdown is rendered, there is a hidden html span tag with the filename part of the url

At least for android and googlebot, the browser evaluates the width of the page as if this span were visible, and you get horizontal scrolling

And the horizontal browsing triggers a penalty in my search engine ranking, according to google webmasters.

I can try to reproduce it here with a jpeg when I get home.

No problem if its a wontfix, just wanted to explain it better.

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [2015年九月15日 16:06 UTC](https://meta.discourse.org/t/lightboxed-images-with-giant-filenames-cause-horizontal-scroll/33346/4 "2015-09-15T16:06:23Z")

</div>

If, in your browser’s inspector, you set `span.filename { color: red; }` on a lightboxed image with a very long filename you will see what is going on when you hover over it.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [2015年九月15日 19:36 UTC](https://meta.discourse.org/t/lightboxed-images-with-giant-filenames-cause-horizontal-scroll/33346/5 "2015-09-15T19:36:54Z")

</div>

The fix here is to use automatic forced wrapping CSS @zogstrip

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [2015年九月16日 09:58 UTC](https://meta.discourse.org/t/lightboxed-images-with-giant-filenames-cause-horizontal-scroll/33346/6 "2015-09-16T09:58:33Z")

</div>

Here’s a fix 🐟

[https://github.com/discourse/discourse/commit/468b04db861a9847a6b6eae18ad2915414700bee](https://github.com/discourse/discourse/commit/468b04db861a9847a6b6eae18ad2915414700bee)

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [2015年九月16日 10:41 UTC](https://meta.discourse.org/t/lightboxed-images-with-giant-filenames-cause-horizontal-scroll/33346/7 "2015-09-16T10:41:27Z")

</div>


