Re: [csswg-drafts] [css-nav-1] Revise selecting best candidate policy (#3386)

After discussing with @junhoseo, the suggestion in https://github.com/w3c/csswg-drafts/issues/3386#issuecomment-526033969 is less convincing because the unnecessary focusable elements are included in the set of the candidate in this way. 

In the situation such as below,
![image](https://user-images.githubusercontent.com/6636090/64335376-a2755580-d015-11e9-935d-9a3388a63a09.png)
when the user presses the down arrow key if **_A_** is a focused element, **_B, C, D, E, F_** and **_G_** are the candidates. But the focus will never moves to **_B_**. 

There are other ways to **selecting the candidates**:
* Set the element as a candidate 
   * if it isn't overlapped with the search origin, its rect should be on the navigation direction
   * if it partially overlaps with the search origin, its two edges which are orthogonal to the navigation direction should be on the navigation direction of the respective ones of the search origin
   * if it fully overlaps with the search origin

(This is same with the [current implementation in blink](https://cs.chromium.org/chromium/src/third_party/blink/renderer/core/page/spatial_navigation.cc?sq=package:chromium&dr=CSs&g=0&l=122))

After selecting the candidates, it selects the best candidate as following:
* If there is any fully overlapped element with the search origin among candidates, measure the inner distance from the search origin and the element to select the best candidate
* Else, use the distance function (https://drafts.csswg.org/css-nav-1/#find-the-shortest-distance) to select the best candidate.

This suggestion seems more reasonable than the [previous suggestion](https://github.com/w3c/csswg-drafts/issues/3386#issuecomment-526033969) and [the spec](https://drafts.csswg.org/css-nav-1/#select-the-best-candidate).
Because 
(1) There will be no unreachable focusable element
(2) The rule is simple


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

Received on Thursday, 5 September 2019 12:17:32 UTC