Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Solved: Toggle "Single" hangs UI
#1
Hi,

today, one more time it occurred to me to click on "Single" while attempting to "Clear queue". So far so good: click once again to disable it, right?
Nope: the screen goes white with a huge squarish moOde picture, semi-transparent, so that its background is more gray than the ordinary black.

I remember another issue with these toggle-switches: they couldn't get deactivated once set... maybe it's related?

Since it happens mostly when operating on the local 7", and it renders the UI unusable, the only solution is a reset. Fortunately I can do a soft one, as I log in on my phone and select "Reboot". It's still annoying, though... @Tim Curtis anywhere I can look, just to keep myself busy tonight? ;-)
Reply
#2
Thats an odd one.

What does this mean? -- click on "Single" while attempting to "Clear queue" --
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#3
(04-18-2023, 09:23 PM)Tim Curtis Wrote: Thats an odd one.

What does this mean? -- click on "Single" while attempting to "Clear queue" --

Well,

I click on the "..." to open the context menu, and proceed to select "Clear queue" to... well, clear the playback queue, but instead my finger lands - by accident - on "Single"... and that's it.
Reply
#4
Hi @Tim Curtis,

I just wanted to see if I could gather some information on this, so tried to reproduce...

If I do this on the browser, from my laptop, everything seems to work, that is: I can toggle "single" without breaking the UI...

Then it hit me... suddenly, instead of clicking anywhere in the middle of the menu item (horizontally, I mean...) I clicked on the check-mark itself, and that broke the whole thing.
To confirm this, I just restarted the UI, and clicked on the check-mark of "Consume", which I keep active... BUM, UI crashed again.


So, it is clicking on the check-mark that crashes the menu handler somehow... debugging javascript I came across something weird... see this

The following is the last CASE statement of the function handling the popup-menu commands, and after clicking on the check-mark, the relevant CASE is executed (say, "single"), and then the execution steps on the lambda callback of the post command below... such php (recorder-cmd.php) does not exist, hence the default-cover-v6.svg, IMO...

The real problem being, though, how is it possible for the code to execute 2 case statements, providing the first IS terminated with BREAK???


Code:
case 'stream_recorder':
           $('#menu-check-recorder').toggle();
           if ($('#menu-check-recorder').css('display') == 'block') {
               SESSION.json['recorder_status'] = 'On';
               $('.playback-context-menu i').addClass('recorder-on');
           }
           else {
               SESSION.json['recorder_status'] = 'Off';
               $('.playback-context-menu i').removeClass('recorder-on');
           }
           $.post('command/cfg-table.php?cmd=upd_cfg_system', {'recorder_status': SESSION.json['recorder_status']}, function() {
               $.post('command/recorder-cmd.php?cmd=recorder_on_off');
           });

I'll have a look if it may appear to be a compressor/obfuscator issue...
Reply
#5
I'm able to repro this and it appears to be an issue with the click event bubbling up through the DOM.

Try adding 

e.stopPropagation(); 

to scripts-library.js

Code:
       case 'single':
           e.stopPropagation();
           $('#menu-check-single').toggle();
           var toggle = $('#menu-check-single').is(":visible") ? '1' : '0';
           sendMpdCmd('single ' + toggle);
           break;

If that works on your end I'll add it to the check mark cases in upcoming 8.3.2 bugfix release.
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#6
(04-19-2023, 12:51 PM)Tim Curtis Wrote: I'm able to repro this and it appears to be an issue with the click event bubbling up through the DOM.

Try adding 

e.stopPropagation(); 

to scripts-library.js

Code:
       case 'single':
           e.stopPropagation();
           $('#menu-check-single').toggle();
           var toggle = $('#menu-check-single').is(":visible") ? '1' : '0';
           sendMpdCmd('single ' + toggle);
           break;

If that works on your end I'll add it to the check mark cases in upcoming 8.3.2 bugfix release.

Hi Tim,

yes, it works, but doesn't close the menu...
Reply
#7
Right, that won't work.

Try adding the code block below to scripts-panels.js. This works on my end.

Code:
   // Prevent click on the menu checkmark from causing default moOde cover to be displayed
   $(document).on('click',
       '#menu-check-cdsp, #menu-check-consume, #menu-check-repeat, #menu-check-single, #menu-check-recorder',
       function(e) {
            e.stopImmediatePropagation();
       }
   );
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#8
(04-19-2023, 07:51 PM)Tim Curtis Wrote: Right, that won't work.

Try adding the code block below to scripts-panels.js. This works on my end.

Code:
   // Prevent click on the menu checkmark from causing default moOde cover to be displayed
   $(document).on('click',
       '#menu-check-cdsp, #menu-check-consume, #menu-check-repeat, #menu-check-single, #menu-check-recorder',
       function(e) {
            e.stopImmediatePropagation();
       }
   );

Hi Tim,

yes, this works fine; thanks.
Reply


Forum Jump: