News for hackers. Stuff that matters.
Re:Show HN: My animated website, rendered entirely in HTML5 ... by nailer on Sunday March 15, 2015 @02:14PM (#9207400)
I see your point, but the text is still text on canvas.

Rather than trying to change the world to not use canvas, how about screenreaders get fixed to read fonts off canvas?

Re:Show HN: My animated website, rendered entirely in HTML5 ... by extra88 on Sunday March 15, 2015 @02:34PM (#9207477)
If that's text, why do some of the letter shapes have jaggies? Screenreaders use the accessibility tree, a subset of the DOM; this "text" isn't in the DOM, it's not real text. Do you think screenreaders perform OCR on pages? JAWS has added an OCR function but it's only for trying to read a single element containing a picture including text (i.e. images) without a real text alternative (e.g. alt attribute).
Re:Show HN: My animated website, rendered entirely in HTML5 ... by nailer on Sunday March 15, 2015 @03:25PM (#9207704)
> If that's text, why do some of the letter shapes have jaggies?

Probably because the site author isn't taking the window.devicePixelRatio and backingStoreRatio when creating the 2D context.

> this "text" isn't in the DOM, it's not real text

The text is not in the DOM, but that doesn't mean it is not real text. It is text, literally strings, written with `context.fillText()` which could certainly be wrapped by screenreader software.

Doing so would make the world a better place for the bling by providing a more consistent experience - since 100% of people using canvas will never get extra budget to modify their logic, but 100% of canvas fillText() calls could be handled by a screen reader.

Unfortunately a great deal of engineers seem to have invested time and reputation in the unlikely change-the-world scenario, so I suspect blind people will continue to have a poor experience on the internet while a11y engineers who don't actually care for workable solutions continue to dominate the discussion.

Re:Show HN: My animated website, rendered entirely in HTML5 ... by afandian on Sunday March 15, 2015 @02:35PM (#9207479)
I don't understand what you mean. Get browsers to OCR the contents of the bitmap? Or have semantically rich mark-up that allows styling of text? (we already have that, it's called HTML+CSS)
Re:Show HN: My animated website, rendered entirely in HTML5 ... by nailer on Sunday March 15, 2015 @03:26PM (#9207706)
Wrap `context.fillText()` - ie, as the text is written to the canvas.
Re:Show HN: My animated website, rendered entirely in HTML5 ... by afandian on Sunday March 15, 2015 @04:44PM (#9208038)
It's an interesting idea.

As it stands, there's a way of saying 'I put some text on the canvas' but no way of saying when it was removed. The whole canvas could be cleared, or a particular region could be cleared, or over-written, or the canvas could be resized, which would result in it being cleared.

So if you wrote to a buffer every time you wrote text to the screen it would fill up pretty quickly. If you animated anything (as is happening in this example), then you'd have a million copies of the same text as it was re-drawn each frame.

There's also the temporal aspect, of course. With CSS it's possible to say 'this text is relevant, but you'll see it in a few seconds'. If you disabled CSS then the text would be there, static. If you were using a screen reader, you wouldn't know it was there until a certain point in time. That's not particularly compatible with the way people use screen readers.

The answer to which might be to manage on-screen resources and keep track of what is visible on screen and when it's removed.

And how do you represent the page hierarchy? You'd have to emulate some kind of DOM.

All of which comes under the banner of 'replicating the stuff that browsers already do, but with inevitable bugs and overhead and things you hadn't thought of'.

I think the appropriate response is to use canvas for interesting graphics that can't be done without it, and to keep text and markup for textual applications. Of course you can push the envelope of what's possible using new tech to create novelties, but it shouldn't be advocated for 'normal' web applications.

It looks like this page is a promo for a general content authoring system based on rendering in canvas, and that's a bad idea for all the above reasons.

Re:Show HN: My animated website, rendered entirely in HTML5 ... by nailer on Sunday March 15, 2015 @06:36PM (#9208505)
> As it stands, there's a way of saying 'I put some text on the canvas' but no way of saying when it was removed. The whole canvas could be cleared, or a particular region could be cleared, or over-written, or the canvas could be resized, which would result in it being cleared.

Indeed. That's a solvable problem - you can track pixels and estimate with a degree of certainty - but it certainly does exist.

You'd also have to determine prominence of the text, which again is solvable assuming the size and weight and zoom level of the text has some bearing on the importance.

And you note the temporal aspect too - you'd have to track whether something was visible, ie sufficiently contrasts against the background, not opaque etc.

And indeed, there's no hierarchy asides from prominence.

All of that, plus more, is far more easier than getting the entire world to avoid, or write fallbacks for canvas.