Re: [csswg-drafts] [css-nav-1] Clarify how sptialNavigationSearch() works (#3743)

While considering this issue, I think the result of `getSpatialNavigationContainer()` needs to be changed.

In the current spec, `getSpatialNavigationContainer()` returns the nearest spatial navigation container of the element. 
If the element is a spatial navigation container, it returns the element itself.
But this may be uncomfortable and change to **return the nearest ancestor spatial navigation container (a.k.a. spatnav container) of the element always** for several reasons.
1. It's tricky to know the nearest ancestor spatnav container of the element (`A`) which is a spatnav container.

   We should implement like:
```js
let spatnavContainer = A.parentElement.getSpatialNavigationContainer();
```
2. The result of `getSpatialNavigationContainer()` seems inconsistant and will confuse the developer who will use this API.

   This API returns the element itself or the nearest ancestor spatnav container depending on the condition of the element. 
   It looks like this API has two features:
   (1) Knowing whether the element is a spatnav container or not
   (2) Knowing the nearest ancestor spatnav container of the element
   I think separating those two features and making this API just return the nearest ancestor spatnav container consistantly for will make clear about the feature of this API.

3. Knowing whether the element is a spatnav container or not isn't hard.
We need to check 
(1) Whether the element is a document or not
(2) Whether the element is a scroll container
(3) Whether the element is specified with `spatial-navigation-container: contain`.

   These conditions aren't hard to check as the API in JS lib.
It would be nice if we have the new API in the spec such as `isSpatialNavigationContainer()`,
but I don't feel this strongly.

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

Received on Wednesday, 24 April 2019 10:10:01 UTC