Hixie's Natural Log

2016-01-13 01:45 UTC Flutter: Accessibility

For the last few weeks I've been working on our accessibility story. I've been focusing on the code in the rendering library that walks the internal layout data structures and builds a tree that describes the application's semantics. To debug it, I've built a fake accessibility tool that then consumes this data and draws the entire description of the application over the top of the application using the foregroundPainter of a CustomPaint widget which wraps the application Widget tree.

This was working great, but I was cheating a bit for the interactivity: while all the application state was being drawn using the custom painter, the actual touch input logic was still being done against the "real" application beneath.

So the next step was to wrap the whole application in a GestureDetector with an IgnorePointer widget inside it. The GestureDetector would get all the touches, which it could then pass to the fake accessibility tool, which would then use the API to the accessibility logic in the rendering library to report the touch, thus completing the circle. The IgnorePointer widget would prevent the touches from reaching the "real" nodes beneath.

Sounds great!

But when I launched it, the screen was blank. After studying it for a minute, I noticed that actually the screen had been replaced by a single, screen-sized button: the GestureDetector I'd just created. My fake accessibily tool was essentially displaying the accessibility tree for itself. Oops.