feat(PageController): exclude aria-hidden elements

This commit is contained in:
Simon
2026-01-14 18:04:31 +08:00
parent 338e317be1
commit a1e70e663d
2 changed files with 11 additions and 3 deletions

View File

@@ -16,6 +16,7 @@
* @edit scrollable element detection
* @edit add `data-browser-use-ignore` attribute
* @edit improve `sampleRect`, filter out rects with 0 area
* @edit exclude aria-hidden elements
*/
export default (
@@ -1446,7 +1447,14 @@ export default (
* @edit add `data-browser-use-ignore` attribute
*/
if (node.dataset?.browserUseIgnore === 'true') {
return true // Skip this node and its children
return null // Skip this node and its children
}
/**
* @edit exclude aria-hidden elements
*/
if (node.getAttribute && node.getAttribute('aria-hidden') === 'true') {
return null // Skip this node and its children
}
// Special handling for root node (body)

View File

@@ -85,8 +85,8 @@ export default function Header() {
role="navigation"
aria-label={t('header.nav_docs')}
>
<span className="text-xs font-mono text-gray-400 dark:text-gray-500 tabular-nums">
v{import.meta.env.VERSION}
<span className="text-xs font-mono text-gray-400 dark:text-gray-500 tabular-nums before:content-['v']">
{import.meta.env.VERSION}
</span>
<Link
href="/docs/introduction/overview"