Toggle buttons with class="additional_info" not working

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
User avatar
erAck
Regular
Posts: 111
Joined: Mon Feb 16, 2015 2:20 am

Toggle buttons with class="additional_info" not working

Post by erAck » Mon Feb 16, 2015 3:16 am

With 2.0 I have a strange experience with a specific Firefox instance/profile where buttons with class="additional_info" are not working in the backend, for example in New Entry the "Entry metadata" and "Advanced Options" buttons for the div class="additional_info" where clicking doesn't even change the arrow icon. Or in Configuration all buttons associated with a fieldset class="additional_info", where clicking changes the arrow icon but nothing else happens. The "Toggle expand all" button however works and and expands all sections.

It works in other browser profiles, so I suspected some extension like Adblock or Disconnect, but starting the browser in safe-mode still had the same effect. I created another browser profile and installed all the same extensions, but also that one works.

Inspecting with Firebug revealed that on the working buttons the additional_info class is removed to show the section or fieldset, but is not removed for the non-working case so they stay hidden.

There must be some setting in the non-working Firefox instance that causes this, but I have no idea what.

Any suggestions?

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Toggle buttons with class="additional_info" not working

Post by garvinhicking » Mon Feb 16, 2015 11:11 am

Have you tried purging the cache of your browser? Maybe the javasript file that does the toggling does not properly work?

Also, you seem to be resourceful, have you tried using Firebug to instpect network traffic and see if there are errors loading the javascript? Or checked the javscript console for error messages?
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

User avatar
erAck
Regular
Posts: 111
Joined: Mon Feb 16, 2015 2:20 am

Re: Toggle buttons with class="additional_info" not working

Post by erAck » Tue Feb 17, 2015 12:09 pm

AHA! Clicking on such button throws a "TypeError: localStorage is null" exception, for example in index.php line 757 where localStorage.setItem() is called.That is due to the config's dom.storage.enabled being set to false, setting that to true it works.

Apparently s9y lacks a check whether local storage is available or not and either choose a different storage method or at least warn the user.

User avatar
yellowled
Regular
Posts: 7083
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

Re: Toggle buttons with class="additional_info" not working

Post by yellowled » Tue Feb 17, 2015 3:02 pm

erAck wrote:That is due to the config's dom.storage.enabled being set to false, setting that to true it works.

Apparently s9y lacks a check whether local storage is available or not and either choose a different storage method or at least warn the user.
As far as I know, that is a setting which has to be explicitly disabled in Firefox using about:config. That is something not every average user will even be able to do. Meaning most FF users will have localStorage available.

Usually, localStorage is only used in the backend JS to store the state of a collapsible element, so it should still be usable if localStorage is not available. We'll need to check if there are instances where this is not true.

YL
amazon Wishlist - Serendipity-Podcast (German only, sorry)

User avatar
erAck
Regular
Posts: 111
Joined: Mon Feb 16, 2015 2:20 am

Re: Toggle buttons with class="additional_info" not working

Post by erAck » Tue Feb 17, 2015 4:28 pm

True, local storage has to be explicitly disabled, but this already happens if you disallow cookies in Firefox. Which I have, along with the Cookie Monster extension to allow cookies from whitelisted sites. Also, it may be that extensions like Better Privacy disable local storage automatically.

User avatar
yellowled
Regular
Posts: 7083
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

Re: Toggle buttons with class="additional_info" not working

Post by yellowled » Tue Feb 17, 2015 7:38 pm

I just committed a fix for this, should work even if localStorage is disabled in 2.0.1. (Although you'll obviously not have the ability to “store” the collapsed/expanded state for collapsible elements in the backend. That's not possible w/o using localStorage or cookies.)

YL
amazon Wishlist - Serendipity-Podcast (German only, sorry)

User avatar
erAck
Regular
Posts: 111
Joined: Mon Feb 16, 2015 2:20 am

Re: Toggle buttons with class="additional_info" not working

Post by erAck » Wed Feb 18, 2015 12:39 am

Hey, thanks a lot :-)

The next least permanent storage possibility would be the sessionStorage btw, but I realize that may not be worth the effort.

User avatar
yellowled
Regular
Posts: 7083
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

Re: Toggle buttons with class="additional_info" not working

Post by yellowled » Wed Feb 18, 2015 11:20 am

sessionStorage is pointless unless you use it to stora data that only needs to “live” for that particular session. That would definitely be an overhead for the things we currently use localStorage for.

YL
amazon Wishlist - Serendipity-Podcast (German only, sorry)

Post Reply