5

The drop-down menus used to select user profile section sorting / display modes in the mobile view stop working after the first click:

Screen recording

I've tested this both in Firefox on my desktop, and in Chrome on my Android tablet, and can confirm that it happens on both.

The problem is actually pretty simple: the event handler that makes the menu work is attached directly to the menu at page load time. However, the handler itself reloads the entire section, including the menu, via AJAX, and does not reattach itself to the new menu.

The fix is also pretty simple: just replace this line in user.js, in the StackExchange.user.init() method:

$('.user-panel-subtabs select').on('change', function() {

with:

$('.user-panel-subtabs select').live('change', function() {

or, better yet (to avoid the deprecated jQuery.live() method):

$(document).on('change', '.user-panel-subtabs select', function() {

Ps. This bug is also masking another, related one: if the same section's sorting / display mode is changed more than once between page loads, on the next reload the section content will (correctly) match whatever was last selected, but the drop-down menu will show the first selection made after the previous page load. This appears to be a server-side issue, so I cannot diagnose it further.


Pps. I've developed a client-side fix for the event handler issue, and a partial fix for the sync issue, which are included in the Stack Overflow Unofficial Patch user script as of version 1.24. Alas, very few (if any) mobile browsers can run user scripts, so the practical value of the fix is limited.

You must log in to answer this question.

Browse other questions tagged .