[whatwg] Outline style to use for drawSystemFocusRing

Ian Hickson ian at hixie.ch
Mon Jan 6 22:54:59 PST 2014

On Mon, 6 Jan 2014, Dominic Mazzoni wrote:
> I understand that the addHitRegion APIs are the intended way to specify 
> the permanent location of a fallback content element. But practically 
> speaking, it makes far more sense to "cache" the bounding box of each 
> element when you call draw*FocusRing, otherwise you end up with a timing 
> problem, because as soon as you focus the fallback element, the screen 
> magnifier immediately wants to know its bounding box - but 
> drawSystemFocusRing may not get called until sometime later, when the 
> app decides to repaint - and by then it's already drawn the bounding box 
> in the wrong location. Some magnifiers respond to a "location change" 
> event, but others don't, requiring an ugly hack like sending a second 
> focus event, or delaying the first one.

The paint is going to come within 16ms (unless the app has high latency, 
in which case it'll be unusable anyway). That's when the magnifier should 
be updated, not when the focus moves in the HTML document.

> The simplest implementation of the current spec to cache the bounding 
> box when you call drawSystemFocusRing and return whenever the assistive 
> technology requests the bounding box of that fallback element, whether 
> it's focused or not. I know it isn't exactly what was intended, and 
> addHitRegion will be a more powerful solution, but I don't see the harm 
> in implementing it this way.

The harm is what I described in the earlier e-mails. You are likely to end 
up zooming on the wrong thing. For example, if the app only renders the 
focused element, and puts it in a random place when it's focused, you'll 
draw the bounding box wherever the control was last time it was rendered, 
which may have nothing to do with where it'll be this time. Similarly, if 
the control is moving, but you only update the bounding box when the 
control is first focused, then you'll leave the magnifier behind.

Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

More information about the whatwg mailing list