W3C home > Mailing lists > Public > public-css-archive@w3.org > April 2019

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

From: Jihye Hong via GitHub <sysbot+gh@w3.org>
Date: Wed, 24 Apr 2019 10:09:59 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-486160981-1556100598-sysbot+gh@w3.org>
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

This archive was generated by hypermail 2.4.0 : Tuesday, 19 October 2021 01:31:07 UTC