Re: [csswg-drafts] [css-nav-1] hostile iframes (#3390)

---

Migrated from https://github.com/WICG/spatial-navigation/issues/58#issuecomment-416872008
Originally created by @frivoal on *Wed, 29 Aug 2018 08:35:26 GMT*

---
@annevk with the possible exception of `window.navigate()`, I don't see what spatnav APIs can do that the `.focus()` method couldn't. It can influence where the focus goes, but within a single document, authors are already free to move it wherever.

For `window.navigate()`, I suppose that it would be possible, knowing the layout of an other site, to put that site in an iframe, use `.focus()` to move the focus in the embedder to a focusable element that is near particular interesting click target in the embeddee, and then use `window.navigate()` to get that element focused. However, It only gets the element focused, it does not click/activate it.

I don't believe that merely focusing an element is a security vulnerability, but maybe I just lack imagination.

If we do want to curtail this, we could do it with 2 steps:
1. navigating towards an iframe always focuses the iframe, rather than its content. This is already the case if the iframe is scrollable, but we could make non scrollable iframes focusable as well.
2. unlike manual navigation, `window.navigate()` cannot move the focus from an iframe to its content, and is a noop (or throws an exception) if you try.

That would limit the usefulness of `window.navigate()` in general, and in particular make it insufficient to drive the test suite.

-- 
GitHub Notification of comment by frivoal
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/3390#issuecomment-443620286 using your GitHub account

Received on Monday, 3 December 2018 07:58:01 UTC