Skip to content

Commit 8d68477

Browse files
navya9singhCopilot
andcommitted
fix(a11y): add H1 and correct heading structure on TSConfig Reference page
Bug: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2201717 - Add <h1>TSConfig Reference</h1> as visible page heading (all other content pages have explicit H1; this page was missing one) - Fix heading skip H2→H4 in showCategories: section group headings now render as <h3> (or no heading for root-level groups, which use <h3> directly for categories — eliminating H2→H4 skip) - Fix heading skip H2→H5 for category names: now <h4> under sections, <h3> at root level - Fix heading skip H3→H5 in extends.md: ##### Example → #### Example (en.md is regenerated from this source at build time) - Update tsconfig.scss to match new heading element selectors axe heading-order rule: 0 violations (was 2) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 89b479f commit 8d68477

3 files changed

Lines changed: 12 additions & 5 deletions

File tree

packages/tsconfig-reference/copy/en/options/extends.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ base config file, and that circularity between configuration files is not allowe
1313

1414
Currently, the only top-level property that is excluded from inheritance is [`references`](#references).
1515

16-
##### Example
16+
#### Example
1717

1818
`configs/base.json`:
1919

packages/typescriptlang-org/src/templates/tsconfig.scss

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
@import "../style/globals.scss";
22

3+
.tsconfig-page-title {
4+
margin-bottom: 1.5rem;
5+
}
6+
37
.tsconfig {
48
margin-bottom: 6rem;
59
// Drastically reduce the padding and margins to make it fit phones
@@ -53,7 +57,7 @@
5357
margin-left: -1rem;
5458
padding-left: 1rem;
5559

56-
h4 {
60+
h3 {
5761
font-weight: normal;
5862
margin-bottom: 0.1rem;
5963
a {
@@ -67,7 +71,7 @@
6771
@media (max-width: $screen-md) {
6872
flex-direction: column;
6973
}
70-
h5 {
74+
h3, h4 {
7175
width: 160px;
7276
flex: 0 0 auto;
7377
}

packages/typescriptlang-org/src/templates/tsconfigReference.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,12 @@ const TSConfigReferenceTemplateComponent = (props: Props) => {
151151
}
152152

153153
const showCategories = (categories: Category[], sectionName?: string) => {
154+
const CategoryHeading = sectionName ? "h4" : "h3"
154155
return <div className={sectionName ? "tsconfig-quick-nav grouped" : "tsconfig-quick-nav"}>
155-
{sectionName ? <h4><code><a href={`#${sectionName}`}>"{sectionName}"</a></code></h4> : <div />}
156+
{sectionName ? <h3><code><a href={`#${sectionName}`}>"{sectionName}"</a></code></h3> : <div />}
156157
{
157158
categories.map(c => <div className="tsconfig-quick-nav-category" key={c.display}>
158-
<h5 id={`quick-nav-${c.anchor}`}>{c.display}</h5>
159+
<CategoryHeading id={`quick-nav-${c.anchor}`}>{c.display}</CategoryHeading>
159160
<ol aria-labelledby={`quick-nav-${c.anchor}`}>
160161
{c.options.map(o => <li key={o.name}><code><a href={anchor(sectionName, o.anchor)}>{o.anchor}</a>{joiner(c.options, o)}</code></li>)}
161162
</ol>
@@ -178,6 +179,8 @@ const TSConfigReferenceTemplateComponent = (props: Props) => {
178179
return (
179180
<Layout title={i("tsconfig_title")} description={i("tsconfig_description")} lang={props.pageContext.locale}>
180181

182+
<h1 className="tsconfig-page-title">TSConfig Reference</h1>
183+
181184
<div className={`tsconfig raised main-content-block markdown button ${openInfo ? "open" : "closed"}`} >
182185
<a href="#" onClick={toggleInfoState} aria-expanded={openInfo} role="button">
183186
<h2>

0 commit comments

Comments
 (0)