Jump to content

Topic on Template talk:Navbox/Flow

Navbox/style.css is loaded in mobile view

6
ネイ (talkcontribs)

@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)?

Izno (talkcontribs)

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.

  1. The CSS doesn't weigh very much in total. That's just my opinion I guess.
  2. 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.

ネイ (talkcontribs)

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.

ネイ (talkcontribs)

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.

Izno (talkcontribs)

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.

Izno (talkcontribs)

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.

Reply to "Navbox/style.css is loaded in mobile view"