Topic on Extension talk:MobileFrontend

Main page won't expand H2

15
Summary by Kizule

Reported on phabricator as https://phabricator.wikimedia.org/T176414

Skonesam (talkcontribs)

The headings appear, but there's no arrow on the left, the sections are unexpanded, and tapping doesn't expand anything. Observed on two different iPhones, in Safari and Chrome. Also in Safari and Chrome on Mac in mobile view.

Using the inspector (on Mac) there's no errors in the console until I click a heading, and then I get "Uncaught ReferenceError: mfTempOpenSection is not defined at HTMLHeadingElement.onclick"

The most annoying part of this is that it's only for the main page. All other pages display and operate (collapse/expand) as normal. Anyone have any idea what might be causing this?

2607:FEA8:4E0:3F:8039:3E4F:700E:ED5E (talkcontribs)

I am having the same problem but have not managed to solve it yet.

Skonesam (talkcontribs)

Not a solution, but I've at least put a note in a DIV tag about what's going on. That DIV is set to hidden in the desktop css so it'll only show on the mobile page.

Skonesam (talkcontribs)

It's a silly work-around, but until I can come up with something better I have a "I'm sorry" message (in the "nodesktop" DIV) and a link to a "mobile_home" page that has the same information as my front page. H2s work great over there. Maddening.

109.164.202.182 (talkcontribs)

I have the same Problem but have no solution.

Harrysummer (talkcontribs)

Same here. No help even I remove the main page and recreate

24.56.238.143 (talkcontribs)
Skonesam (talkcontribs)

Any idea how to submit a bug report?

Harrysummer (talkcontribs)
Skonesam (talkcontribs)
Touam (talkcontribs)
203.149.77.98 (talkcontribs)

Same problem here. Has anyone found a permanent fix?

13.82.107.202 (talkcontribs)

My workaround is to add a custom script as the mfTempOpenSection function seems to be removed on the main page (though the minerva toggling script does seem to init on the sub pages somehow)

//Removes the current mfTempOpenSection function so we don't get console errors on heading clicks

$('.section-heading').prop('onclick',null);

//Add a new function that changes the display parameter of the collapsible div associated to the clicked header

$('.section-heading').click(function($event){

    var source = $event.target;

    var sectionHeadings = $('.section-heading');    

    sectionHeadings.toArray().forEach(function(section){

       var span = section.getElementsByTagName('span')[0];

       if (span.id == source.id){

         var collapseDiv = section.nextSibling;

         collapseDiv.style.display = collapseDiv.style.display == "block" ? "none" : "block";

         return;

       }

    });

});

I added this to the MediaWiki:Mobile.js page so that it only runs in mobile view. Not the prettiest thing but at least the sections can show content now.

Maiden taiwan (talkcontribs)

Simplest workaround -- just enclose your entire main page content in a div. This disables the MobileFrontEnd "feature" of nonexpanding headings on the main page.