In the current spec, the candidates within the spatial navigation container are the visible focusable element in the inside area of the spatial navigation container.
The inside area of container C is defined as below:
- the optimal viewing region of C if C is a scroll container,
- the viewport of C’s browsing context if C is a Document,
- the border box of C otherwise
However, the third case, when the container C is the element specified with spatial-navigation-contain: contain (which means custom spatial navigation container), there are some confusing cases if the inside area is defined as the border box of the container.
For example,

<div id="container1">
<div id="container2" style="--spatial-navigation-contain: contain;">
<button id="b1" style="top:40px; left:-60px; background-color: purple;"></button>
<button id="b2" style="top:30px; left:200px; background-color: pink;"></button>
</div>
<button id="b3" style="top:10px; left: 20px; background-color: green;"></button>
</div>
Depending on the current definition, button#b1 and button#b2 aren't included in the candidates of #container2 because those are out of #container2's the border box.
But button#b1 and button#b2 are definitely visible, so someone may feel it's strange.
Therefore how about changing the definition of inside area for the custom spatial navigation container?
It could be changed to the viewport of the container's browsing context.
In the current spec, the candidates within the spatial navigation container are the visible focusable element in the inside area of the spatial navigation container.
The inside area of container C is defined as below:
However, the third case, when the container C is the element specified with

spatial-navigation-contain: contain(which means custom spatial navigation container), there are some confusing cases if the inside area is defined as the border box of the container.For example,
Depending on the current definition,
button#b1andbutton#b2aren't included in the candidates of#container2because those are out of #container2's the border box.But
button#b1andbutton#b2are definitely visible, so someone may feel it's strange.Therefore how about changing the definition of inside area for the custom spatial navigation container?
It could be changed to the viewport of the container's browsing context.