html - Activating parent link with keyboard focus on tabbable child without Javascript? -


consider situation this:

<a href="#">     <div tabindex="0">tab focus me, ⏎</div> </a> 

if i'm focused on <div /> , press enter, different behaviour across major desktop browsers (os x yosemite):

  • chrome 54.0.2840.71: parent link not activated. both <a /> , child <div /> separately selectable tab.
  • firefox 48.0.2: <a /> doesn't seem selectable itself, link can activated focus on <div />.
  • opera 39.0: same behaviour chrome.
  • safari 9.1.2: firefox, <a /> isn't selectable, when <div /> selected, link isn't activated.

since <a /> can't nested, there way make focused child element activate parent link across browsers without javascript? javascript option obvious, find unbelievable simple need it.

any element tabindex considered interactive content

see: http://w3c.github.io/html/single-page.html#kinds-of-content-interactive-content

the tabindex attribute can make element interactive content.

and interactive elements can not belongs a[href] tag

the element may wrapped around entire paragraphs, lists, tables, , forth, entire sections, so long there no interactive content within

so won't able achieve without javascript it's not browser should normally.


Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -