Skip to main content

compare_tab_indices

Function compare_tab_indices 

Source
fn compare_tab_indices(a: i32, b: i32) -> Ordering
Expand description

Compare two tab indices according to https://html.spec.whatwg.org/multipage/#tabindex-value.

Ordering::Less: The index should come before the other in sequential focus order. Ordering::Equal: The two indices should be processed in DOM order, respecting focus direction and focus scopes. Ordering::Greater: The index should come after the other in sequential focus order.

Note that a tabindex of 0 should come after all others, which is essentially why we need this function.