Re: [csswg-drafts] [css-nav-1] Remove kAlignWeight? (#4567)

Great question! I would explain how to come up with `kAlignWeight: 5` as a heuristic estimation.

The alignment factor has recently added to the distance formula for prioritizing quite aligned candidates. However, what the new factor applies into the existing distance formula has several consideration. As you mentioned, when two candidates are at the same distance, a number between 0 and 1 would have no problem. But we need to consider the case of none the same distance as per [1] of the following image.

<img src="https://raw.githubusercontent.com/anawhj/images/master/alignweight.png">

Without the alignment factor in [1], B is the best candidate from A with a right direction, but we want it to C as the best candidate. That's one of the reasons that we added the alignment factor, so the value of kAlignWeight was a number much more than 5 at first for even covering 490px from A to B.

However, we found unreachability and jumping cases like as [2] above. With the alignment factor more than 5 in [2], F could be the best candidate from D with a down direction so that E becomes an unreachable element from D and F. In the text-based web contents (e.g. Wikipedia), it could happen a lot between hyperlinks. In the background, we set kAlignWeight to 5 for avoiding the unreachable case.

That's the history about `kAlignWeight: 5`. It's a heuristic estimation, so seems no perfect solution on which all people agree. If I miss something or you have another great idea, please feel free to share it.

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

Received on Tuesday, 10 December 2019 02:53:11 UTC