Closed erwanlfrt closed 2 years ago
That's indeed an issue, and your first solution is what it's supposed to be. Let me see if I can patch it in the coming days. Thanks for spotting it.
That's indeed an issue, and your first solution is what it's supposed to be. Let me see if I can patch it in the coming days. Thanks for spotting it.
Any idea if you're going to fix this in the near future?
Fixed in 1a59d0bda1cbae89cb44babbefb8bafa2438a1bf. Thank @erwanlfrt again for pointing this out.
ISSUE : defaultElement is not working properly with selectors
A - The issue
The
defaultElement
is not working properly.According to the documentation about defaultElement :
However in the source code, into _spatialnavigation.js -> function getSectionDefaultElement, l. 561 :
The default element is indeed the first element matching the selector but the first element is not necessarily within the targeted section.
Example with this sample :
And for section2 the following configuration :
In this case,
parseSelector(defaultElement)[0]
will return the<button class="target" >Button 1</button>
element because the selector is.target
. But this element is not within section2 so it will not be focused but the source code does not check if other elements returned byparseSelector(defaultElement)
is within the targeted section.B - Solutions to fix it...
1 - Checking each returned element
Edit - 04/01/2022 A simple way to fix it :
2 - Changing the documentation
If it is the normal behavior then change the documentation about
defaultElement
by something like that: