Reported by jkiss on 2012-03-15 09:48
If focus is set to an element made interactive with some key-based event handler, and that element has a nested link as its first item, activating that interactive element will fire the nested link, even with focus set to the link's parent. This does not happen if the nested link is preceded by any other content, including simple inline text.
For example, see http://www.accessibleculture.org/misc-tests/link-inside-onclick.html
James, you've previously mentioned that this happens because when the interactive element gains focus, NVDA moves the browse mode cursor to the start of the interactive element. Since the start of the element is the link, the browse mode cursor moves to the link. In browse mode, the space and enter keys always operate on the object under the browse mode cursor, not the focused object. You noted that this needs to be done because it's sometimes necessary to activate elements which aren't focusable. As such, pressing enter on the interactive parent activates the link.
This has problematic ramifications, particularly for the HTML5 details/summary elements, where the content model for the summary element is, for better or worse, phrasing content, which includes links. Whether or not details/summary is used, it is not unreasonable to expect links to be included in the content of a disclosure type element or other elements that might have nested links as their first bits of content, but where following the nested link upon pressing the space or enter keys on the focussed parent is not expected.
Comment 1 by jteh on 2012-03-15 22:10
This is definitely a problem when focus is set other than by NVDA itself; e.g. programmatically or by pressing the tab key. A work around for now is to just move the browse mode cursor outside of the nested link, which will move focus to the parent element.