mirror of https://github.com/twbs/bootstrap.git
Docs: add aria label on section headings anchor links (#41487)
BrowserStack / browserstack (push) Has been cancelled
Details
Bundlewatch / bundlewatch (push) Has been cancelled
Details
CodeQL / Analyze (push) Has been cancelled
Details
cspell / cspell (push) Has been cancelled
Details
CSS / css (push) Has been cancelled
Details
Docs / docs (push) Has been cancelled
Details
JS Tests / JS Tests (push) Has been cancelled
Details
Lint / lint (push) Has been cancelled
Details
CSS (node-sass) / css (push) Has been cancelled
Details
Release notes / update_release_draft (push) Has been cancelled
Details
Close Issue Awaiting Reply / issue-close-require (push) Has been cancelled
Details
BrowserStack / browserstack (push) Has been cancelled
Details
Bundlewatch / bundlewatch (push) Has been cancelled
Details
CodeQL / Analyze (push) Has been cancelled
Details
cspell / cspell (push) Has been cancelled
Details
CSS / css (push) Has been cancelled
Details
Docs / docs (push) Has been cancelled
Details
JS Tests / JS Tests (push) Has been cancelled
Details
Lint / lint (push) Has been cancelled
Details
CSS (node-sass) / css (push) Has been cancelled
Details
Release notes / update_release_draft (push) Has been cancelled
Details
Close Issue Awaiting Reply / issue-close-require (push) Has been cancelled
Details
Co-authored-by: Julien Déramond <juderamond@gmail.com> Co-authored-by: Patrick H. Lauke <redux@splintered.co.uk>
This commit is contained in:
parent
a61555b6c2
commit
3663e3a061
|
@ -5,7 +5,7 @@ import mdx from '@astrojs/mdx'
|
|||
import sitemap from '@astrojs/sitemap'
|
||||
import type { AstroIntegration } from 'astro'
|
||||
import autoImport from 'astro-auto-import'
|
||||
import type { Element } from 'hast'
|
||||
import type { Element, Text } from 'hast'
|
||||
import rehypeAutolinkHeadings from 'rehype-autolink-headings'
|
||||
import { getConfig } from './config'
|
||||
import { rehypeBsTable } from './rehype'
|
||||
|
@ -59,7 +59,10 @@ export function bootstrap(): AstroIntegration[] {
|
|||
{
|
||||
behavior: 'append',
|
||||
content: [{ type: 'text', value: ' ' }],
|
||||
properties: { class: 'anchor-link' },
|
||||
properties: (element: Element) => ({
|
||||
class: 'anchor-link',
|
||||
ariaLabel: `Link to this section: ${(element.children[0] as Text).value}`
|
||||
}),
|
||||
test: (element: Element) => element.tagName.match(headingsRangeRegex)
|
||||
}
|
||||
],
|
||||
|
|
Loading…
Reference in New Issue