← Back to context

Comment by NooneAtAll3

19 hours ago

> Don't roll your own page scrolling.

browser should not even let the page see this action

> Don't roll your own link navigation.

browser should not even let the page see this action

> Don't roll your own text selection.

browser should not even let the page see this action

> Don't roll your own copy and paste.

browser should not even let the page see this action

I'm serious. WHY javascript code is even allowed to see all these actions of the user? We already loaded the page and rendered it - we users must already be free to do with the content as we please

> WHY javascript code is even allowed to see all these actions of the user?

scrolling: used by games, maps, image viewers

link navigation: used for client-side routing (youtube/twitch, any website with a chat window)

text selection and copy/paste: word processors, spreadsheet editors, forum software, etc.

I'm not sure if your question was sincere or if you were trying to say that the web should not support these use cases.

  • Yes, you get to the heart of the problem - we turned what started of as a document viewer into a general purpose application platform.

    Features paramount in a document viewer (broadly, "respect the user's local document viewing preferences") aren't desirable in a general purpose application platform.

    A large number of companies/web developers don't think of themselves as offering the user a document to view on their own terms, but rather an "experience" that they want full control over (which means, most of the time: show ads and record user behavior).

    If you're offering me a game, fair enough. But if you're showing me my hotel reservation or electric bill, I want a document, not an ""experience"".

  • On the extreme end, a web app can do all of its own rendering in a canvas with WebGL/WebGPU. Some apps do exactly this: Figma, Google Maps, Google Docs. Just to name a few. (edit: Earlier I claimed PDFjs uses canvas, but it does not. I was confusing it with Google Docs [1].)

    It's a thing you can do. But it is very bad for extensions and extension developers for the same reasons that Java applets, Flash, and Shockwave were bad for the web. These apps are difficult for end users to customize. It's a real bane to tinkerers. And it's a shame that "view source" has slowly grown completely useless over the decades.

    [1]: https://workspaceupdates.googleblog.com/2021/05/Google-Docs-...

  • > scrolling: used by games, maps, image viewers

    Out of curiosity, does anyone like the way Google Maps hijacks scrolling? I use a trackpad. When I scroll, I'd want it to pan around on the map, not zoom in and out (which always feels awful as a scroll action and never stops where I want it to).

    Click-drag to pan doesn't feel nice.

    It doesn't really matter anymore, since 99% of maps use is on mobile now, but this was always a small pain point to me in the past.

    • If you mean you prefer pinch/spread for zoom-out/in, I prefer the status quo with trackpad 2-finger scroll for zooming.

      Pinching/spreading with index and middle finger feels unergonomic. Using my thumb on the trackpad would also feel unnatural, as would putting my 2 index fingers on the trackpad.

      2 finger scroll is something you can "fling" such that the zooming motion continues even as your fingers have been lifted off the trackpad. Trying to "fling" a spread-out motion with your index and middle finger is an awkward motion, and of course in a pinching motion, your fingers would just crash into each other, so you'd have to lift before they crash. Pretty awkward.

      On the phone, I often prefer tap then drag up/down (i.e. touch, lift, touch, slide) to zoom in/out with a single finger. It allows me to "fling" the zooming motion so it continues after I've lifted my finger. It makes a phone's interface behave like a trackpad's scrolling-zoom.

    • I never liked it either.

      Panning by swiping feels so natural. That it breaks on a trackpad feels like a major oversight.

Because the web browser was burdened with the role of application host, and not just presentation of static content. There's no going backwards.

  • this is why the web stack feels like a car held together with duct tape these days. we collectively took the wrong fork in the road and doubled, tripled, and quadrupled down. computing in general is glorious when i feel like im working near computing and then i get to web app stuff and im like.. i dunno. sad. i get why we ended up where we did with web stacks but seriously what a nightmare

    • It's not a nightmare. It's the most popular gui/document/app platform for a reason. It's complex because it has to cater to many types of usecases. Name one platform that's better. I think people have tried and some might have even succeeded in limited slice of what web can do.

      I have strong suspicion that it's exactly because of the “document” history why web is so approachable to creators, why there is “view source” and ultimately why you can hop from simple html blog, to CRUD app, to advanced CAD software.

All of these annoyances and more can be blocked by StopTheMadness (available for iOS and macOS):

https://underpassapp.com/StopTheMadness/

  • > Sold separately

    aaaand you lost my interest the moment money got involved

    all these things are already fixable by browser extensions - what is lacking is exposing that in browser options and even making it the default

    • > all these things are already fixable by browser extensions

      Which is what StopTheMadness is and does.

I found that most internet pages are greatly enhanced by disabling JavaScript in my web browser.

  • It depends. A lot of websites refuse to display some stuff without JavaScript, and of course online payments insist on JavaScript (to the point that trying to push through without it can result in strange errors and potential double-charges as you troubleshoot).

  • total disabling of JS is overkill

    I mean, I'm all for for switching to Lua or smth (which is a slightly different anti-JS camp than yours), but the problem isn't in interactive (or even non-frozen) pages in general - it's in pages reading user actions that user doesn't expect/want to

It should be illegal for a website to hijack text copying, right clicking, or keyboard shortcuts like Ctrl*f.

  • No. There are already too many batshit insane laws trying to regulate the internet. We need less, not more.

    • Indeed, people talk about technical solutions to social problems but there is also such a thing as trying a legal solution for a technical problem.

> WHY javascript code is even allowed to see all these actions of the user? We already loaded the page and rendered it

Nope we haven’t. At least not in a web application. At least not since the days Infinite Scrolling was invented. IIRC Twitter, for eg, only renders a partial list depending on the scroll position.

I once wrote a NER tagger, where implementing custom text selection allowed users to not stress about selecting the exact word boundaries when manually tagging 1000s of words per day.

I can probably find legitimate use cases for almost of these things in the list. While I agree with the broader theme of the article, this idea that the user agent should be a dumb display is not valid.

The Web is an ads platform with useful functionality as bait.

That's all there really is to it: Mosaic added image support. Investors got excited and asked if the images could animate, if they could record click data and credit card data, if they could add video and additional presentational elements. Holistic user experiences were secondary.

To move forward we have to accept that most of this wasn't an accident and it needs some breaking changes.

Applications like Google Docs would be impossible without each of the four things you listed being available. We had Google Docs that didn’t roll-your-own for each of the items in that list and it was called Writely and it was absolute dogshit (but super cool for its time) because those limitations were too extreme. And by extension it wouldn’t make sense to have Chromebooks as a category of hardware, because web software could never compete at a feature parity level with native software.

  • > Applications like Google Docs would be impossible without each of the four things you listed being available.

    I was already in favor of banning it. You don't have to keep trying to convince me.

    Okay, snark off. But as someone who dislikes the proliferation of "web apps", I'd be perfectly happy to see Google Docs and others die off if it meant we moved back to real, locally run applications.

  • I would rather not have Google Docs than have all the other crap that comes along with allowing every website to do stuff that Google Docs "needs".

  • Seems like exactly the kind of thing permissions are for.

    • That is indeed how things like copy/paste through the menus already work; you install an extension to get the clipboard permission or the browser limits you to keyboard shortcuts

> WHY javascript code is even allowed to see all these actions of the user?

Because the alternative is UI/UX Designers and Visionary Managers insisting on keeping Flash and Java Applets and Microsoft Visual Silverlight .Net++ around forever, because you can't do some things in the browser and We Need To Do Them.

Some things have minimal complexity that either lives in the language itself or in libraries. The Web has minimal bells and whistles that are either implemented in the browsers itself or in plugins.

  • Nobody “needed” the web to do these things. We decided that the effort and cost of making native applications was too great. I’d argue we went the wrong way given that even the same browser will exhibit slightly different behavior depending upon the underlying platform upon which it runs.

Also: Javascript should not be able to touch the browser history. I know it's useful for some apps. But it's too prone to abuse and that API should be revoked.

  • my main argument against this has been reading books

    I don't enjoy needing to "go back" 100 times, once for each page of the book just to return to f.e. search results I opened the book from

>WHY javascript code is even allowed to see all these actions of the user? We already loaded the page and rendered it - we users must already be free to do with the content as we please

Because on the modern web, the user is the content, sold to the highest bidder.