Firefox and Switching Styles
Fixes
I had decided to take another shot at Bug 32372: should be able to disable CSS towards the end of this past spring. (My first one triggered a layout crasher that has since been fixed.) Once I'd written a fix for it on the 1.8alpha3 trunk, I queried Ben to see if he wanted the feature backported to the Aviary 1.0 branch, then filed bug 253332 and wrote a patch to do just that.
So when Brendan wrote about over-enthusiastic feature removals on the Aviary branch, he tapped me and asked if I could fix the buggyness in the switcher so he could argue for its re-introduction. I told him I'd work on it, but I needed 253332 checked in to do it.
Once the patch for 253332 had been checked in, I closed off all but one of the existing Firefox AltSS bugs in short order:
- 220975 - Style sheet selector does not display "No Theme" for pages without a base stylesheet (but shows Basic Theme) [FIXED by checkin for 253332]
- 224250 - Selecting "No Theme", then reselcting "Basic Theme" doesn't reapply styles [FIXED by checkin for 253332]
- 220649 - No Theme Selection Not Available on CSS sites that don't offer alternate stylesheets [FIXED by patch]
- 216424 - Can't use stylesheet switcher from keyboard [FIXED by checkin to 220649]
- 257157 - Alternate Style Icon shown even when no alternate styles (only one preferred one) [FIXED by patch]
Together with the fix for 253332, the effect of these changes is:
- The alternate style switching menu has a real No Style
option that disables the author style level entirely (from within Gecko).
This affects linked style sheets, embedded style sheets,
style
attributes, and presentational HTML like<font>
tags. - The alternate style icon is a reliable indicator of when alternate styles are available, not of when one of the style sheets happens to have a title.
- A new submenu, View > Page Style, has been added to allow style switching from the menus. This makes the switcher accessible from the keyboard and makes the No Style option available on sites that don't offer an alternate style (and therefore won't have the switcher icon).
- Firefox (in addition to the Mozilla trunk builds) supports
document.preferredStylesheetSet
. - Basic Page Style only shows up on pages that don't have a preferred style. This is consistent with the original intent that "Basic Page Style" only serve as a placeholder label for pages that otherwise don't have a title for their default style selection.
As Brendan noted in his roadmap post, the Aviary team re-enabled the AltSS UI on September 9th.
However, there's still one major bit of missing AltSS switching functionality, and that's selection persistence. Rob Tougher's Style Sheet Chooser extension does take care of this, but it does so in a way that I'm not comfortable adding to Firefox core. (I tried to write a temporary JS fix myself, but after spending a week exploring Mozilla's documented and undocumented interfaces for a way to trigger at the right point in page loading, I decided it wasn't worth it.) Either way, the real fix for persistence will come when bugs 200930 and 83663 are fixed, both major changes to Gecko. (Boris and I have plans for those two.)
UI Notes
There have been some questions about adapting the UI to handle this situation. We don't want users to consider the feature useless and ignore it even once we have persistence just because it doesn't persist now. One person suggested removing the AltSS UI altogether and leaving the No Style option as a main menu item in place of the Page Style submenu. However, I believe the best course is to remove the statusbar icon and to leave the View submenu intact. Once we have style history implemented, then we can put back the icon.
Advantages to this approach:
- The placement (and checkbox vs. radio behavior) of the No Style option is consistent across releases.
- No Style (which is drastic and certainly not more commonly-used than text zoom) is tucked away in a submenu along with related items.
- The style switching functionality is not removed. (It's not broken or notably buggy anymore anyway.)
- The icon is not drawing the attention of users yet, so they won't try it, be disappointed at the lack of persistence, and ignore it in the future.
- Once we've got the style history working and are confident in how the feature behaves, we can use the addition of the icon as a non-intrusive way of advertising style switching to the user. (It will draw attention to the new persistence scheme for people who already know about the Page Style submenu, too.)
Notice
This should go without saying, but.. if you don't have any comments that will help us fix a given bug, don't comment in the bug report. (I.e. encouragement is not encouraged.) You can add yourself to the CC list or vote for it, though.
Dare to dream.