vitepress icon indicating copy to clipboard operation
vitepress copied to clipboard

Hide JS-required features if JS disabled

Open Pandapip1 opened this issue 2 years ago • 9 comments

Things like light/dark mode and searching don't work properly when scripts are disabled. This hides those broken features when they are, well, broken.

Pandapip1 avatar Sep 06 '23 19:09 Pandapip1

There are actually many more things that will be broken. For example all of these need js-required:

image

copy code, code groups, sidebar groups, vplocalnav, vpflyout, last updated, ... all of these will need js-required.

brc-dd avatar Sep 10 '23 14:09 brc-dd

It looks like code groups and last updated are rendered server-side, so this should be fine.

Also - I would really like it if localnav could be modified to work without JS. I think it's possible.

Pandapip1 avatar Sep 10 '23 22:09 Pandapip1

CC @brc-dd for re-review

Pandapip1 avatar Apr 22 '24 16:04 Pandapip1

To be honest... wouldn't it make more sense if we create a new JS free theme if we need one 🤔 ? If we add this, anytime we add new feature to the theme, we have to be very careful. And probably end up having give up slightly complicated feature because of this limitation.

I don't think majority of users uses VitePress site without JS enabled 👀

kiaking avatar Apr 23 '24 05:04 kiaking

I agree that JavaScript-disabled users are likely to be an extreme minority of vitepress visitors. That's why I think this solution is better.

The point of this is pull is just a one-off improvement that ensures that most of the stuff that is broken when JavaScript is disabled is hidden. I don't want to add any more maintenance burden onto the maintainers of this project. I know how overworked the maintainers of all major open source projects already are. If someone later notices that something doesn't work without JS, they can create pull request in that adds the js-required class themself.

Pandapip1 avatar Apr 23 '24 14:04 Pandapip1

he point of this is pull is just a one-off improvement that ensures that most of the stuff that is broken when JavaScript is disabled is hidden.

It wouldn't be one-off, since we must keep this in mind forever in the future whenever we add new feature to the theme. And also "most of the stuff" would be an issue to because if we miss 1 part, we have to fix it once this change is introduced.

If someone later notices that something doesn't work without JS, they can create pull request in that adds the js-required class themself.

This would be a bit unrealistic. Once any feature is added to the core, we can't ignore those features just because it wasn't added by the team.

I still believe creating a new theme that is carefully tailored in a way that works smoothly without JS would be much simpler 👀

kiaking avatar Apr 24 '24 10:04 kiaking

I still believe creating a new theme that is carefully tailored in a way that works smoothly without JS would be much simpler 👀

I disagree; I can't see a way to create an entirely new theme from scratch that is somehow ~~more~~less effort than this. I would love to be proven wrong, but I don't feel that I have enough time to learn how to do that properly. Also, it still wouldn't change the fact that there are broken features with the default theme with javascript off.

This would be a bit unrealistic. Once any feature is added to the core, we can't ignore those features just because it wasn't added by the team.

Yes, you absolutely can ignore them. You're a volunteer maintaining a FOSS project. Don't feel that just because you've helped make something, that you have to maintain it for all of eternity :)

It's unreasonable to assume that a feature will be maintained if nobody is interested in maintaining it.

Pandapip1 avatar Apr 24 '24 15:04 Pandapip1

I disagree; I can't see a way to create an entirely new theme from scratch that is somehow more effort than this.

Fork this repo then apply this change. Done.

kiaking avatar Apr 25 '24 00:04 kiaking

Sorry, brain fart. Meant less, not more.

Pandapip1 avatar Apr 25 '24 01:04 Pandapip1