userstyles.world icon indicating copy to clipboard operation
userstyles.world copied to clipboard

[bug] Global userstyle marked as error

Open XCanG opened this issue 3 years ago • 4 comments

I've uploaded global userstyle, which applied to all websites: https://userstyles.world/style/8802/thin-scrollbars-and-tab-size-fix however it doesn't allowed me to do so without changes, so I had to bypass check for @-moz-document.

Error message:

Error: Bad style format (visit https://userstyles.world/docs/faq#bad-style-format-error)

This is definitely error on a site, since this style work fine. It just not attached to any site.

If there is problems with checking styles, then may be add option to the site to mark userstyle as global, so that it wont be marked as corrupted.

To reproduce: simply create new style, remove all website checks in Stylus and write some CSS rules, then try to upload it on userstyles.world and you will get that error.

XCanG avatar Mar 03 '23 22:03 XCanG

One of the versions of Stylus had a bug in its integration with USw, which allowed users to upload userstyles without sections. While this might be seen as a bug on our end, it's not a bug per se. Making global userstyles without defining where they apply is merely a convenience. What's more, we could go and enforce the use of @-moz-document for all userstyles, old and new.

Adding a button wouldn't resolve it in all cases because some users don't know what they're doing. Just to illustrate that point, there are users that made global userstyles which removed everything and they couldn't figure out how to fix it, so Stylus had to implement a workaround that excluded global userstyles from affecting its UI unless it was targeted specifically. There's a point to be made that enforcing sections wouldn't resolve all cases either, so I'm kinda torn which road to take.

vednoc avatar Mar 09 '23 22:03 vednoc

Is this really a Stylus bug? I never seen any @-moz-document for global styles anywhere. If you want to enforce it's usage, you should then provide a message for users who intentionally want to post global styles to fix them. But in either case it should work in Stylus when installed which in current case is work and not seems like a bug.

XCanG avatar Mar 15 '23 13:03 XCanG

I apologize for not being clear in my initial reply.

For example, let's suppose you had the following userstyle:

@-moz-document domain('example.com') {
	* { color: red !important }
}

In early versions of Stylus' integration with USw, you would end up with this code on USw:

* { color: red !important }

So, a userstyle that's supposed to apply only to example.com is now applying globally. That wasn't correct, so it resulted in a bunch of broken userstyles. This requirement was set in place to prevent even more broken userstyles at the cost of having to explicitly set "applies to" configuration for actual global userstyles. In my opinion, it seemed like a good decision. Since global userstyles are rare, those that create and share them should know exactly what they're doing.

vednoc avatar Mar 15 '23 14:03 vednoc

Ok, but there is need a way to create global userstyles too, which is why I say that you may add check to interpret userstyle as global and give warning if there @-moz-document present with this check being checked.

My userstyle change scrollbars to thin scrollbars and fix tab-size to 4 from 8 globally.

Additionally before installation you may add warning that this style is global and will affect all websites, so that users will know that fact.

XCanG avatar Mar 16 '23 08:03 XCanG