[whatwg] Behavior of anchor element when wrapping floated images

Ian Hickson ian at hixie.ch
Tue Dec 3 15:27:08 PST 2013


On Mon, 14 Oct 2013, Bruno Racineux wrote:
>
> I've ran into the following layout issue while using the accessibility 
> audit extension on Chrome. 
> https://github.com/GoogleChrome/accessibility-developer-tools/issues/64
> 
> In brief, there is an accessibility issue with floated images within an 
> anchor element, which is present on the web on a potentially large 
> scale, making links to images invisible to keyboard readers.
> 
> Should the anchor tag be made to wrap around a floated image to address 
> this?
> 
> Presumably, it'd think the container size should match that of the 
> clickable area? (instead of being 0 0)
> 
> Or should a recommendation be made to float the anchor instead as the 
> only way to get around this?
> 
> I would appreciate some feedback.

On Tue, 15 Oct 2013, Tab Atkins Jr. wrote:
> 
> This is a CSS issue, not an HTML one - floated elements don't affect the 
> sizes of their container elements, so if you float out all the contents, 
> it collapses to a 0-height element (and, for inlines, 0-width).
> 
> The semantics are still fine.  You can avoid any weirdness with focus 
> outlines by floating the <a> instead - it should have the same effect.

Indeed. Or you can style things inside links, as in a:focus > img.

-- 
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