Niedzielski has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/384995 )
Change subject: Fix: decrease content header indent levels ...................................................................... Fix: decrease content header indent levels Fix an off-by-one error when calculating content section header tags. Change-Id: Ie078d8040e1f2d37ee45590834362d6bdc4623d0 --- M src/common/components/content-section/content-section.tsx M src/common/components/dynamic-header/dynamic-header.tsx M src/common/models/page/page.ts 3 files changed, 5 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/marvin refs/changes/95/384995/1 diff --git a/src/common/components/content-section/content-section.tsx b/src/common/components/content-section/content-section.tsx index 03fc7c4..a87ad83 100644 --- a/src/common/components/content-section/content-section.tsx +++ b/src/common/components/content-section/content-section.tsx @@ -12,7 +12,7 @@ return ( <section class="ContentSection" id={section.fragment}> {section.titleHTML && ( // Omit empty headers such as the lead. - <DynamicHeader class="ContentSection-header" level={section.level}> + <DynamicHeader class="ContentSection-header" level={section.level + 1}> <Content dangerouslySetInnerHTML={{ __html: section.titleHTML }} /> </DynamicHeader> )} diff --git a/src/common/components/dynamic-header/dynamic-header.tsx b/src/common/components/dynamic-header/dynamic-header.tsx index dbca970..4a068a1 100644 --- a/src/common/components/dynamic-header/dynamic-header.tsx +++ b/src/common/components/dynamic-header/dynamic-header.tsx @@ -7,6 +7,6 @@ ...props }: { level: number } & ChildrenProps & ClassProps): JSX.Element { const classes = classOf("DynamicHeader", props.class); - const Header = level <= 0 ? "div" : `h${Math.min(level, 6)}`; + const Header = level < 1 ? "div" : `h${Math.min(level, 6)}`; return <Header class={classes}>{children}</Header>; } diff --git a/src/common/models/page/page.ts b/src/common/models/page/page.ts index d4b60f2..f8b0489 100644 --- a/src/common/models/page/page.ts +++ b/src/common/models/page/page.ts @@ -9,7 +9,9 @@ /** * Zero-based section header or indent level often used as h1, h2, h3, ... - * The lead is zero and all subsequent sections are one or greater. + * The lead is zero and all subsequent sections are one or greater, so for a + * page with <h1>title</h1> and <h2>title</h2>, one must be added to the level + * when calculating which h1..6 tag to use. */ level: number; -- To view, visit https://gerrit.wikimedia.org/r/384995 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie078d8040e1f2d37ee45590834362d6bdc4623d0 Gerrit-PatchSet: 1 Gerrit-Project: marvin Gerrit-Branch: master Gerrit-Owner: Niedzielski <sniedziel...@wikimedia.org> Gerrit-Reviewer: Sniedzielski <sniedziel...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits