-
Notifications
You must be signed in to change notification settings - Fork 659
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[css-nav-1] Revise selecting best candidate policy #3386
Comments
Migrated from WICG/spatial-navigation#94 (comment) For case #2, and minimizing unreachable case, I suggest an additional step 'internal search' in processing model. Let's see following scenario. In this scenario, currently red color element is active element. 3 elements are children of a container element(blue color). Meanwhile, there is green element and it is (visually) inside active element. And let it is not child of the container. Usually, such green element never gets focus because it is encapsulated(In this scenario, green element can get focus through yellow element. But it is introduced to show an important case.). And we hit down key. For now, let's see how 'internal search' step works. In internal search step, valid rectangle is defined. It is rectangle of active element, and limits focus candidate. Also we define starting point as edge of active element. In this scenario, only green element is candidate for getting focus in internal search step. Important different point between internal search for active element and finding in container is, in case of internal search, candidate should be 'fully' inside of valid rect. But, in case of finding in container, partially visible element can be candidate. This is why yellow element can't be candidate. I think we can integrate this step with existing processing model.
So, let's see, how integrated processing model works. |
Migrated from WICG/spatial-navigation#94 (comment) I think there are several issues being discussed at the same time in this one. Separating them into sub topics:
As for the rest, which I think is best described in WICG/spatial-navigation#94 (comment), I think I was actually confused when I said I agreed. In WICG/spatial-navigation#94 (comment), if the green box is in the same container as the other boxes, the specification already handles that. However, if it is not in the same container, then it seems that skipping it is a feature, not a bug. That is what containers are for. If that's not desired, then making the "blue" box in that example a container seems like a mistake. Is there any situation where we would want the blue box to be a container, but still go from red to green? |
Migrated from WICG/spatial-navigation#94 (comment)
Yes. Spatnav looks outside of activeElement, also looks partially insersecting element. But never looks inside element.
I think using edge as search origin in common cases can minimize unreachable problem. But it maybe reduce intuitiveness. For example, in above scenario, left(apricot? color) and right(yellow color) can be candidate when we hit down key. It looks like such elements are not placed in direction. Of course, it depends on the person. What do you think? |
Migrated from WICG/spatial-navigation#94 (comment) :) Focusable elements are placed as grid. And red color element is active element. I think most people expect yellow element will get focus. But actually, green element will get focus because it is placed in direction and closest element with red element. How we can resolve this problem when we use active element's edge as starting point in common cases? |
Migrated from WICG/spatial-navigation#94 (comment)
The problem is that spatnav only looks outside of activeElement's visual box, right?
Perhaps this is all we need to do (no need for an extra "internal" step)? I wonder if we ever need to use the complete "focus box".... Perhaps edges as search origin give good enough approximations for most (all?) distance calculations? |
Migrated from WICG/spatial-navigation#94 (comment)
Yes, they can, which is good. All visible focusables in the direction, down, should be considered candidates. The green focusable will anyway win because it's closer to activeElement. |
Migrated from WICG/spatial-navigation#94 (comment)
Yes. The focus will move depending on the DOM order if the candidates have the same distance from the active element.
In that regard, we need to consider the visual inclusion relation in this case. The content area of the (A) |
Migrated from WICG/spatial-navigation#94 (comment) I think the suggestion in WICG/spatial-navigation#94 (comment) is actually quite good. Should we write it in the spec first, or first try to implement in the polyfill, try it to see if it is nice, and update the spec only if we like it? |
Migrated from WICG/spatial-navigation#94 (comment) I agree. :) I get your point... One alternative could be to prioritize elements that are fully aligned (i.e. elements that can be [partly] projected onto each other)...? |
Migrated from WICG/spatial-navigation#94 (comment)
Oh, the case is already noticed by @jihyerish at WICG/spatial-navigation#94 (comment) :) |
Migrated from WICG/spatial-navigation#94 (comment) For case 1 in WICG/spatial-navigation#94 (comment), I am much less sure what the order should be if not the DOM. The one most in front? The largest one? The one with the largest visible area? I am not 100% sure how to decide which answer is best. |
Migrated from WICG/spatial-navigation#94 (comment) Hi @frivoal,
Would you please explain how spec handles?
In above case, a link "arrow keys" is placed in two lines. So the layout box of the element will be red box. Meanwhile, another link "modifier key" is placed in red box. So in this case, we hardly navigate into "modifier key. |
The remaining issue here is the focusable element inside the search origin(currently focused element) is unreachable via spatial navigation. This can be divided into two cases: Case 1. The search origin is the general focusable element I think Case 2 is already covered in the spec because the spec mentions that the focus will move to each fragment separately. However, Case 1 isn't considered in the current spec. For example, A, B, and C are the focusable elements. Therefore I think the spec should add description such as:
@junhoseo, what do you think? |
Hi @jihyerish , As my understand, your suggestion looks similar with previous discussion: Are there any differences between the discussion and your suggestion? |
@junhoseo , those aren't different. |
After discussing with @junhoseo, I noticed that the previous suggestion in #3386 (comment) is less convincing because the unnecessary focusable elements are included in the set of the candidate in this way. There are other ways to selecting the candidates and I'd like to suggest it to resolve this issue:
(This is same with the current implementation in blink) After selecting the candidates, it selects the best candidate as following:
This suggestion seems more reasonable than the previous suggestion and the spec. |
@jihyerish , looks good to me your last suggestion :) |
… search origin Consider the focusable element which fully overlaps with another focusable element. Detailed changes are as below: 1. Add another condition to the definition of 'inside area' * To consider the focusable element which fully overlaps with search origin as a candidate for enabling the focus to move there. 2. Make the difference the way to select 'insider' depending on wheather the search origin is a spatial navigation container or not * If the search origin is container, consider the partially visible focusables as the insider. * Else (if the search origin is the general element), consider only the fully overlapped focusables as the insider. * NOTE: The partially overlapped focusable isn't included in the set of insider. 3. Modify the way to select candidates among visible focusable elements * To measure the distance from the elements which is outside to the search origin. Close w3c#3386
* If there is any element which is visually fully overlapped with the target, then move the focus to it. * Otherwise, move the focus among the elements which are visually partially overlapped or totally oustide of the target. * Add the test case for the upated feature * Remove unnecessary files Related: w3c/csswg-drafts#3386
* If there is any element which is visually fully overlapped with the target, then move the focus to it. * Otherwise, move the focus among the elements which are visually partially overlapped or totally oustide of the target. * Add the test case for the upated feature * Remove unnecessary files Related: w3c/csswg-drafts#3386
Migrated from WICG/spatial-navigation#94
Originally created by @junhoseo on Mon, 20 Aug 2018 01:57:40 GMT
Currently we consider distance and order in DOM structure. But sometimes these are not sufficient for reasonable choice.
Case 1:
In above case, distance with active element is same each other. So blue element will be selected if it is earlier element in DOM tree, and yellow element will be selected on the contrary.
Case 2:
Sometimes a focusable element can be placed inside another focusable element. In this case, should we allow focus moving to opposite element? Opposite element is not placed in direction, but partially.
The text was updated successfully, but these errors were encountered: