From 027d40fb8a39283145e4eb2d0f36714e7db6877c Mon Sep 17 00:00:00 2001 From: Sergey Zolotonos Date: Fri, 13 Mar 2026 17:28:56 +0300 Subject: [PATCH] fix: suppres read term definition on focus term --- src/transform/plugins/term/index.ts | 2 +- src/transform/sanitize.ts | 1 + test/__snapshots__/term.test.ts.snap | 26 +++++++++++++------------- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/transform/plugins/term/index.ts b/src/transform/plugins/term/index.ts index 65ddb1cf..39e8bb69 100644 --- a/src/transform/plugins/term/index.ts +++ b/src/transform/plugins/term/index.ts @@ -12,7 +12,7 @@ function setTermAttrs(token: Token, termKey: string): void { token.attrSet('class', 'yfm yfm-term_title'); token.attrSet('term-key', ':' + termKey); token.attrSet('role', 'button'); - token.attrSet('aria-describedby', ':' + termKey + '_element'); + token.attrSet('aria-controls', ':' + termKey + '_element'); token.attrSet('tabindex', '0'); token.attrSet('id', generateID()); } diff --git a/src/transform/sanitize.ts b/src/transform/sanitize.ts index a788444c..ab6d7c93 100644 --- a/src/transform/sanitize.ts +++ b/src/transform/sanitize.ts @@ -299,6 +299,7 @@ const htmlAttrs = [ 'aria-hidden', 'referrerpolicy', 'aria-describedby', + 'aria-controls', 'data-*', 'wide-content', 'sticky-header', diff --git a/test/__snapshots__/term.test.ts.snap b/test/__snapshots__/term.test.ts.snap index 45babd68..5e50263e 100644 --- a/test/__snapshots__/term.test.ts.snap +++ b/test/__snapshots__/term.test.ts.snap @@ -113,7 +113,7 @@ exports[`Terms > Should create term in table with definition template 1`] = ` @@ -149,7 +149,7 @@ exports[`Terms > Should create term in text with definition template 1`] = ` @@ -165,7 +165,7 @@ exports[`Terms > Should emit lint token for undefined term in lint mode 1`] = ` @@ -188,7 +188,7 @@ exports[`Terms > Should handle asterisk inside term text 1`] = ` @@ -198,7 +198,7 @@ exports[`Terms > Should handle asterisk inside term text 1`] = ` @@ -231,7 +231,7 @@ exports[`Terms > Should handle term inside superscript 1`] = ` @@ -259,7 +259,7 @@ exports[`Terms > Should keep term definition referenced transitively through ano @@ -284,7 +284,7 @@ exports[`Terms > Should keep term definition referenced transitively through ano @@ -308,7 +308,7 @@ exports[`Terms > Should preserve regular links and convert term links 1`] = ` @@ -335,7 +335,7 @@ exports[`Terms > Should remove unused term definition when reference is inside f @@ -363,7 +363,7 @@ exports[`Terms > Should strip undefined term links and keep content 1`] = ` @@ -402,7 +402,7 @@ exports[`Terms > Term should use content from include 1`] = ` @@ -466,7 +466,7 @@ exports[`Terms > Term should use escape regexp like chars 1`] = `