User talk:CapitalR/Navbox

From Wikipedia, the free encyclopedia

[edit] "plain" vs. "off"

Do we need "off" as a parameter when "plain" has already been implmemented? It only complicates the code. EdokterTalk 11:43, 18 March 2008 (UTC)

  • No, I suppose we don't need the "off" one also. I'll remove it from the code. --CapitalR (talk) 03:28, 19 March 2008 (UTC)

[edit] Small CSS problem

I now notice that existing tables (not navboxes) using the navbox class, now have a too small font for their title header. Example: {{Tenthdoctorcompanions}}. Is there a way we can remdy this? EdokterTalk 19:06, 1 April 2008 (UTC)

Hmmm, good catch. I'm working on it. --CapitalR (talk) 21:37, 1 April 2008 (UTC)
Ok, the best thing to do here is to make {{Tnavbar-collapsible}} function the same way as {{Navbox}} for the title font-size. What we need to do is to add some span tags with style="font-size:110%" in the {{Tnavbar-collapsible}} template. I just did some tests with this and it seems to correct most of the problems. I'll code that up, run some more tests just to be sure, and then put in an editprotected request to that page. --CapitalR (talk) 22:01, 1 April 2008 (UTC)
Ok, I just put in an editprotected request for the changes. --CapitalR (talk) 22:21, 1 April 2008 (UTC)
It's not a problem with Tnavbar-collapsible, it's happening without it as well. I think the CSS just needs some refinement, ie. no blanket font-size of 88% fot the entire table, but give each element their own font-size. EdokterTalk 22:24, 1 April 2008 (UTC)


I just ran some tests and here's the results I found:

  • About 2200 templates use the navbox class directly (i.e. they have class="... navbox ...", but don't use {{Navbox}}). All templates that currently use {{Navbox}} shouldn't (in theory) have a header with small font).
  • Of those 2200, about 1850 of them use {{Tnavbar-collapsible}} for their header (these should be fixed by my code modification to that template); only 368 do not use it (as of the March 15th database dump).
  • Of those 368 that would not be fixed by the change to {{Tnavbar-collapsible}} above, based on my very rough estimations, about 100 would still be left with the small title bug. This is small enough that I could go through them manually and either convert them to use {{Navbox}} or to use {{Tnavbar-collapsible}}, which would fix the problem.

Here's the templates with the problems (note, it's based on a 3/15 database dump, so some of them have actually been converted to Navbox since then, making the 368 number higher than it actually is):

List removed to get links out of the What Links Here lists; see history

So, in conclusion, I think that the changes to {{Tnavbar-collapsible}} should fix most of the problems, with a small number of templates requiring work to be done to them by hand. Just as side note: only a tiny handful of templates use {{Tnavbar-collapsible}} without using class="navbox"; I checked them out and none should have any problem with the code change.

If you can, give me a list of a few templates that are giving you problems, and I can check them out. I'm doing all my testing in Firefox and IE7, so let me know what browser you're using too. Thanks for the help! --CapitalR (talk) 22:45, 1 April 2008 (UTC)

That's quite a list. Just clicking a few of those reveal that about half of them do use navbox as the base template. And as you said, tnavbar-collapsible is used by other templates as well. I think a CSS fix is the easiest and most effective solution, though it may require adding a class like (td).navbox-list. I ultimately think that would be the most painless solution; a table should look the same no matter if it is used by template or class alone. EdokterTalk 23:37, 1 April 2008 (UTC)
Hmmm, I can't quite figure out what kind of CSS change would fix this problem. The only real change in the CSS in the last 24 hours was the navbox font-size going from 90% to 88% (which makes the apparent font-size in IE the same as in all the other browsers), but it seems this problem existed before that change was made (at least in Firefox). The basic problem with changing the CSS to try to fix the title font-size, is that the show/hide button is set to take on the size of the title. Thus, I see no way to change the CSS to fix the title size, and keep the show/hide button the same size (if we change the CSS to make the title bigger, instead of using the span tag solution that navbox currently uses, then the show/hide button will get a bigger and uglier). Even if we were to solve that problem, we'd still be left with another one: the CSS class would need to set the font-size for "table.navbox th" to be 110%; but, in templates that don't use {{Navbox}}, but do use class="navbox" (such as {{Tenthdoctorcompanions}}), there are other TH cells in the table (used for groups) that would be adversely effected (i.e. their font would also grow to 110% which would be bad). I really think that the Tnavbar-collapsible edit is the best solution, and I'll be willing to go through them all with AWB to ensure that everything works smoothly. Also, I just converted all templates that used Tnavbar-collapsible without using "navbox", and so none will be adversely effected by the code change. If it doesn't solve our problems, then we can just revert it and work on plan B.
As a second reason to do it this way, I'm also planning on converting a vast majority of the 2200 templates that use class="navbox" but not {{Navbox}} as soon as the new template code goes into action on May 1, so any extra complexity to the CSS now will be left pointless after those conversions are completed.
Lastly, setting the font-size for each element individually in CSS (i.e. font-size for groups, lists, above/below, title) isn't such a great idea, because nested Navboxes would not be able to inherit these properties from their parent navbox (which is a key design point of the new code). For example, a nested navbox list would get 88% font from the parent, and another 88% font from itself, making the font tiny. The users would have to manually set the font-size to be bigger for all groups/lists/abovebelow/title, etc. for all subgroups, which isn't ideal. Thus, I'm rather hesitant to mess around with the font-size, and think we should just leave it where it is now. In conclusion, I think the edit to Tnavbar-collapsible is the easy answer to our problems, not the CSS (let's at least give it a shot, and if it doesn't work for all the templates, then we can just revert the edit and try a CSS solution). --CapitalR (talk) 00:14, 2 April 2008 (UTC)
OK, you have a point regarding inheritence. Very well, let's do it your way. EdokterTalk 11:39, 2 April 2008 (UTC)
Cool, thanks. --CapitalR (talk) 20:13, 3 April 2008 (UTC)