Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/transform/plugins/term/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down
1 change: 1 addition & 0 deletions src/transform/sanitize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ const htmlAttrs = [
'aria-hidden',
'referrerpolicy',
'aria-describedby',
'aria-controls',
'data-*',
'wide-content',
'sticky-header',
Expand Down
26 changes: 13 additions & 13 deletions test/__snapshots__/term.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ exports[`Terms > Should create term in table with definition template 1`] = `
<i class="yfm yfm-term_title"
term-key=":html"
role="button"
aria-describedby=":html_element"
aria-controls=":html_element"
tabindex="0"
id
>
Expand Down Expand Up @@ -149,7 +149,7 @@ exports[`Terms > Should create term in text with definition template 1`] = `
<i class="yfm yfm-term_title"
term-key=":html"
role="button"
aria-describedby=":html_element"
aria-controls=":html_element"
tabindex="0"
id
>
Expand All @@ -165,7 +165,7 @@ exports[`Terms > Should emit lint token for undefined term in lint mode 1`] = `
<i class="yfm yfm-term_title"
term-key=":myterm"
role="button"
aria-describedby=":myterm_element"
aria-controls=":myterm_element"
tabindex="0"
id
>
Expand All @@ -188,7 +188,7 @@ exports[`Terms > Should handle asterisk inside term text 1`] = `
<i class="yfm yfm-term_title"
term-key=":popup1"
role="button"
aria-describedby=":popup1_element"
aria-controls=":popup1_element"
tabindex="0"
id
>
Expand All @@ -198,7 +198,7 @@ exports[`Terms > Should handle asterisk inside term text 1`] = `
<i class="yfm yfm-term_title"
term-key=":popup2"
role="button"
aria-describedby=":popup2_element"
aria-controls=":popup2_element"
tabindex="0"
id
>
Expand Down Expand Up @@ -231,7 +231,7 @@ exports[`Terms > Should handle term inside superscript 1`] = `
<i class="yfm yfm-term_title"
term-key=":popup1"
role="button"
aria-describedby=":popup1_element"
aria-controls=":popup1_element"
tabindex="0"
id
>
Expand Down Expand Up @@ -259,7 +259,7 @@ exports[`Terms > Should keep term definition referenced transitively through ano
<i class="yfm yfm-term_title"
term-key=":html"
role="button"
aria-describedby=":html_element"
aria-controls=":html_element"
tabindex="0"
id
>
Expand All @@ -284,7 +284,7 @@ exports[`Terms > Should keep term definition referenced transitively through ano
<i class="yfm yfm-term_title"
term-key=":css"
role="button"
aria-describedby=":css_element"
aria-controls=":css_element"
tabindex="0"
id
>
Expand All @@ -308,7 +308,7 @@ exports[`Terms > Should preserve regular links and convert term links 1`] = `
<i class="yfm yfm-term_title"
term-key=":myterm"
role="button"
aria-describedby=":myterm_element"
aria-controls=":myterm_element"
tabindex="0"
id
>
Expand All @@ -335,7 +335,7 @@ exports[`Terms > Should remove unused term definition when reference is inside f
<i class="yfm yfm-term_title"
term-key=":html"
role="button"
aria-describedby=":html_element"
aria-controls=":html_element"
tabindex="0"
id
>
Expand Down Expand Up @@ -363,7 +363,7 @@ exports[`Terms > Should strip undefined term links and keep content 1`] = `
<i class="yfm yfm-term_title"
term-key=":myterm"
role="button"
aria-describedby=":myterm_element"
aria-controls=":myterm_element"
tabindex="0"
id
>
Expand Down Expand Up @@ -402,7 +402,7 @@ exports[`Terms > Term should use content from include 1`] = `
<i class="yfm yfm-term_title"
term-key=":html"
role="button"
aria-describedby=":html_element"
aria-controls=":html_element"
tabindex="0"
id
>
Expand Down Expand Up @@ -466,7 +466,7 @@ exports[`Terms > Term should use escape regexp like chars 1`] = `
<i class="yfm yfm-term_title"
term-key=":*"
role="button"
aria-describedby=":*_element"
aria-controls=":*_element"
tabindex="0"
id
>
Expand Down
Loading