ElkArte Community

Elk Development => Bug Reports => Exterminated Bugs => Topic started by: scripple on September 21, 2014, 01:01:02 am

Title: Linktree text overflows box
Post by: scripple on September 21, 2014, 01:01:02 am
The way the linktree is currently coded, long thread titles overflow the linktree.  They run under the "arrow" (rotated box) and onto the background.  Especially on narrow mobile views.  The reason it's not obvious here is the linktree foreground text color and the background color are similar (or equal maybe) but it was very obvious on my dark theme with light text flowing onto the dark background.

I fixed it making the following changes to the linktree css.  This would be in index_light.css

Code: ("before") [Select]
.linktree a {
  color: #555;
}

Code: ("after") [Select]
.linktree a {
  color: #555;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

Haven't noticed any glaring side effects, but just made the change on my test forum.  I'd noticed the issue for a while but since it didn't show up here I figured it was fixed in 1.0.   Then when finally working on installing 1.0 I noticed it was just the colors making it work.
Title: Re: Linktree text overflows box
Post by: emanuele on September 21, 2014, 05:05:45 am
I tried here:
http://www.elkarte.net/community/index.php?topic=2048.0
okay, I guess I can now see it at low resolutions.
It also shows some more problems (message index and the h2 tag) that would benefit from some make-up... :-\

ETA: oh, and the recent posts in the info center.
Title: Re: Linktree text overflows box
Post by: emanuele on September 21, 2014, 07:58:17 am
Tracked: https://github.com/elkarte/Elkarte/issues/1825
Title: Re: Linktree text overflows box
Post by: scripple on September 27, 2014, 11:52:26 pm
Sigh.  This doesn't work for the reply page because of the extra <span><strong>... elements which cause the block to be on a newline.   And inline-block doesn't know the containing element width correction.  So I'll call for someone better at CSS to help fix this.
Title: Re: Linktree text overflows box
Post by: emanuele on September 28, 2014, 03:07:05 am
Not easy to fix I guess...

/me has no idea
Title: Re: Linktree text overflows box
Post by: Spuds on September 28, 2014, 10:32:29 am
Do we really need to bold that anyway?  Could do it with last child as well and get rid of the extra reply markup?
Title: Re: Linktree text overflows box
Post by: scripple on September 28, 2014, 11:52:00 am
You would have to put it into the link itself to not have the problem.  Or figure out how to get the link to truncate without display=block.  (inline-block didn't work.)
Title: Re: Linktree text overflows box
Post by: Spuds on September 28, 2014, 01:19:57 pm
Well poop .... I added that max-width to try and contain those darn long names .... maybe just to back to allowing it to wrap?
so replace
Code: [Select]
.linktree:last-child {
max-width: 25em;
}
with
Code: [Select]
.linktree:last-child>a {
display: inline;
}
?
Title: Re: Linktree text overflows box
Post by: scripple on September 28, 2014, 02:40:18 pm
I don't see that max-width anywhere in my 1.00 code, but just putting in the second part didn't cause things to wrap for me.  It left it overflowing.
Title: Re: Linktree text overflows box
Post by: emanuele on September 28, 2014, 03:48:24 pm
I uploaded here the last change suggested by Spuds.
Title: Re: Linktree text overflows box
Post by: scripple on September 28, 2014, 04:04:03 pm
It's still broken like the original.  Change the text color to red and you'll see it's overflowing the box still.
Title: Re: Linktree text overflows box
Post by: Spuds on September 28, 2014, 04:35:02 pm
Oh I see it on narrow screens with a long subject ... meh, chasing our tails ... i'm just going to cut its length in the sources as I'm not in a corner case mood  :P
Title: Re: Linktree text overflows box
Post by: Spuds on September 28, 2014, 04:39:33 pm
From a quick look, maybe
Code: [Select]
.linktree:last-child>a {
display: inline;
}
change that to display block then ... still going to cut that in sources since the topic subject is repeated immediately below that

Ah scratch that, thats what messes up the reply page :P ... cut me Mick, cut me !
Title: Re: Linktree text overflows box
Post by: emanuele on September 28, 2014, 05:07:46 pm
Have a look if this fixes it: https://github.com/emanuele45/Dialogo/commit/2101c85dd459634a24ff1396c47815a8acbad84a
Title: Re: Linktree text overflows box
Post by: Spuds on September 28, 2014, 05:21:36 pm
And I did this: https://github.com/elkarte/Elkarte/pull/1839  O:-)
Title: Re: Linktree text overflows box
Post by: scripple on September 28, 2014, 06:02:33 pm
Quote from: Spuds – Ah scratch that, thats what messes up the reply page :P ... cut me Mick, cut me !
Yep, that's what brought me to raise this from the dead.  Noticed the same issue with my initial fix.

Haven't looked at ema's latest.  If you want to change source you could have made the extra before and extra after or whatever be just text inside the link.  Then the reply page would work.
Title: Re: Linktree text overflows box
Post by: Spuds on September 28, 2014, 06:32:20 pm
May give that a whirl, I think thats what ema's fix does anyway.  Of course just being on the link diminishes what you can do with them past just plain text. 

Then again those before and after are used a total of 3 times! (2 before's and 1 after) so not super important, kind of seem like leftovers really.  One adds a count after the text, the other adds Post Reply (  ... and a trailing )

I guess if ema's fix works and it leaves some flexibility in place thats cool, otherwise I'd say remove them as sillly.
Title: Re: Linktree text overflows box
Post by: Spuds on September 29, 2014, 09:40:02 am
Quote from: emanuele – Have a look if this fixes it: https://github.com/emanuele45/Dialogo/commit/2101c85dd459634a24ff1396c47815a8acbad84a
I think that is on the site now and the problem on the reply screen is that it still wraps across 3 rows,  A couple of attempts to get it inline result in the overflow text.  There may be a magic css bean to fix this but it I can't find it.

I think the options are
1) move the text to the link text (does remove special styling capability)
2) To me if we do the above, then simply remove the extra_before extra_after and simply add the text to the 'name' tag.  Those extra_ are only used in two places.
3) Since long link titles are ugly anyway, util:shorten-text on the post screens, the information in the link is redundant anyway
Title: Re: Linktree text overflows box
Post by: emanuele on September 29, 2014, 10:00:44 am
Yeah, mine to work needs (still, at least, unless I missed something... LOL):
Code: [Select]
display: block;
max-width: 25em;
overflow: hidden;
on the additional span.
Title: Re: Linktree text overflows box
Post by: Spuds on September 29, 2014, 10:43:37 am
Give it a shot on the site, easier to test :D
Title: Re: Linktree text overflows box
Post by: emanuele on September 29, 2014, 12:26:14 pm
I replaced:
Code: [Select]
.linktree:last-child {
max-width: 25em;
}
with:
Code: [Select]
.linktree:last-child>span>a {
display: inline;
}
.linktree:last-child>span {
display: block;
overflow: hidden;
max-width: 25em;
}
Title: Re: Linktree text overflows box
Post by: Spuds on September 29, 2014, 12:36:53 pm
Looks good to me  :)
Title: Re: Linktree text overflows box
Post by: scripple on October 01, 2014, 10:07:41 pm
I'm not sure I got all the changes exactly as you have them.  I added the extra span to index.template.php and put these in index_light.css

Code: [Select]
.linktree:last-child>span>a {
  display: inline;
}
.linktree:last-child>span {
  display: block;
  overflow: hidden;
  max-width: 100%;
  text-overflow: ellipsis;
}

Using max-width:100% seems to still shorten it correctly but lets it go long if the screen can hold it.  (Well, I didn't try the single word long title) and the ellipsis is just for style.

And the change I had suggested have been removed entirely.

Is that correct?
Title: Re: Linktree text overflows box
Post by: scripple on October 03, 2014, 12:49:12 am
Seems to be working.  Good job.  Thanks.
Title: Re: Linktree text overflows box
Post by: emanuele on October 03, 2014, 03:07:37 am
Quote from: scripple – Using max-width:100% seems to still shorten it correctly but lets it go long if the screen can hold it.
I tried 100%, I personally didn't like that much the title go on the second line if too long, so I reverted to 25em just to have something shorter.

Quote from: scripple – And the change I had suggested have been removed entirely.

Is that correct?
Yep, I think so. Even though I lost a bit track of all the versions. lol
Title: Re: Linktree text overflows box
Post by: scripple on October 03, 2014, 10:33:37 am
Ok.