@Izno Though Navbox is stripped off from mobile view, Module:Navbox/styles.css is still loaded in pages where Navbox is used. Is there a way to not load the TemplateStyles when Navbox is stripped off (not displayed)?
Topic on Template talk:Navbox
I think you could wrap the TemplateStyles tag with something like <div class="nomobile">. The module needs to be adjusted to do the same thing for all the templatestyles tags. This would be fairly easy. I have seen this issue noted on Phabricator somewhere.
I am not totally sure there is a lot of benefit to this.
- The CSS doesn't weigh very much in total. That's just my opinion I guess.
- At some point, navboxes may not be stripped out of mobile, so that's an additional change that would need to be made to undo these changes.
On the other hand, wrapping the TemplateStyles in something like that might also make it easier to do the "single border" CSS that is currently worked around by lots of link and style tags, at least in this module.
I will test whether nomobile
works.
The concern here is that, while we no longer load the styles in desktop view when navbox is not used, we add the styles to mobile view when navbox is used (but stripped out). So the benefit of reduced page size in desktop view is cancelled out by increased page size in mobile view. I do agree that making this change means one more fix to be applied when navboxes are no longer stripped out.
The change in Special:Diff/4775222 works. Doing the same for all TemplateStyles in Navbox could avoid the increased page size issue in mobile view.
Yeah, it probably works, but there's still a problem in that the "single border" negative margin doesn't work because one of the style tags (that shouldn't be there anyway) is getting fostered above the navbox element. I haven't figured out how to take care of that yet.
Ok, I figured out, it was a problem with the sandbox version of the template.
Now live here. You'll want to make an adjustment to your /styles.css as well possibly for the + selector rules.