Live data from Hacker News

If you want to create a button from scratch, you must first create the universe

madcampos.dev

21–30 of 144 posts

Re: If you want to create a button from scratch, you must first create the universe

#21
Very slightly off topic but also on, I’ve noticed a tendency for well-meaning accessibility folks to drive to bad outcomes to meet some standard. Color is one where the standard is usually right, but there’s pretty strong evidence that the standard is bad in some cases. See APCA v WCAG. https://git.apcacontrast.com/documentation/WhyAPCA.html

If you click any link on this page (to the author’s site) and you dare to use an alternative browser on iOS, it shows a full page modal that can only be navigated around by clicking an “escape” button which tries to execute a Siri shortcut. Apparently in-app browsers are a threat to user freedom, but Orion is caught in the dragnet. Perhaps an example of the paternalist approach to development on the web gone wrong.

Re: If you want to create a button from scratch, you must first create the universe

#22

I expected a blog on how to write a button using a graphics API and basic OS interface; but instead I completely mistook (what the comments are saying is) sarcasm as advice on how to program for the web. I'm not a web guy, so I'm not really even sure why this is sarcastic, isn't semantic web good? I can't keep up with the opinions.

Semantic web is good if you are making web documents not web applications.

  Have a type and: submit a form; reset a form; or not do anything with the related form.  
No one uses buttons to submit a form in web applications. You use buttons to start/stop/change interaction flow.

Native browser controls are not workable in a modern web application. It is not that developers are lazy it is that you get requirements from businesses that no one would pay for implementing using native controls because it would cost too much to do it right, where right means „how customers want it and how they want to use it” not „technically right like some native browser control nerds feel world should work”.

Re: If you want to create a button from scratch, you must first create the universe

#24

My understanding is Apple / Webkit is blocking custom element extension on native HTML elements, which would cut down this 500 line monster to: class SaganButton extends HTMLButtonElement { … } Anyone know the reasoning they’re blocking this?

The only browser Apple is blocking it on is Safari: other browsers implement it just fine, and the standard passed over Apple's objections. The rationale was architectural, arguing that extending built-in components would lead either to brittle components that would break when new properties were added or causing the specification of builtin components to freeze forever to avoid such breakage. I'm not sure I buy the arguments 100%, but for sure it's not evil/incompetent board executives twirling their mustaches as they deliberately break the web: https://github.com/WICG/webcomponents/issues/509#issuecommen...

Re: If you want to create a button from scratch, you must first create the universe

#25
post #14

Just coming off a wild ride where a client was sued by a non-customer and a rapacious legal firm, who claimed that said client's website was not sufficiently accessible. The day after the lawsuit was filed, a company specializing in accessibility testing mysteriously contacted the client, offering a solution. Client had not even gotten notice of the litigation yet. The net result of this was several tens of thousands…

> In 3 years, all this compliance shit will be out the window, because AI screen readers and agents are going to make the whole point moot. Since the whole compliance racket is totally disconnected from actual accessibility outcomes, why would AI have any impact here? There’s a standard and a law and money to be made.

Because the law doesn't stipulate which methods you use to make something accessible to people with disabilities. It just requires that everyone have equal access. To litigate, someone has to show that they couldn't access something, and that the failure to access it caused them some measurable harm. In a couple years you can show a judge that a free LLM screen reader could have solved their access issues, and my guess is that those cases will then be thrown out, and the predatory law firms will move on to something juicier.

Re: If you want to create a button from scratch, you must first create the universe

#26
Great article! I spot a few bugs with event handling, but in some ways that adds to the premise.

The implementation assumes that onpointerup is mutually exclusive to the other two, but it fires in addition to mouse/touch events. Only onpointerup is needed, if you include onmouseup and ontouchstart then the button action will fire twice.

However, you also need an onpointerdown handler to verify that the pointer press started inside the button. Without it, the button would activate if you started holding down the mouse button outside the button area, and then releasing inside the button area.

Re: If you want to create a button from scratch, you must first create the universe

#27

I sometimes wonder how much slower technological progression would have been, if we hadn't taken whatever widget engine any given OS gave us, and instead constantly debated over and recreated every feature in the OS, like we do with web interfaces. The crazies part is that when we actually research it, a default button is about 20% faster than the the flat nonsense we've settled on ( https://www.theregister.com/offbe…

This is really an Apple thing, rigidly enforcing whatever their current OS aesthetic looks like. But Apple (or Xerox) invented the UI paradigms we're still living with. Look at the progress of Flash/AIR AS3 as an embedded runtime prior to its annihilation. By 2010 or so, it had the capability to leverage the GPU on pretty much any device, directly uploading bitmaps and shaders. It had garbage collection as good as or…

> except for one: It was closed source.

And it was a security nightmare...

Re: If you want to create a button from scratch, you must first create the universe

#30

Earlier quoted context omitted.

This is really an Apple thing, rigidly enforcing whatever their current OS aesthetic looks like. But Apple (or Xerox) invented the UI paradigms we're still living with. Look at the progress of Flash/AIR AS3 as an embedded runtime prior to its annihilation. By 2010 or so, it had the capability to leverage the GPU on pretty much any device, directly uploading bitmaps and shaders. It had garbage collection as good as or…

> except for one: It was closed source. And it was a security nightmare...

..., slow and resource-hungry, prone to crash, ...
Post reply on HN