[whatwg] Behavior of anchor element when wrapping floated images

Tab Atkins Jr. jackalmage at gmail.com
Tue Oct 15 10:04:17 PDT 2013

On Mon, Oct 14, 2013 at 4:04 PM, Bruno Racineux <bruno at hexanet.net> 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.

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,

The semantics are still fine.  You can avoid any weirdness with focus
outlines by floating the <a> instead - it should have the same effect.


More information about the whatwg mailing list