Skip to content

Commit

Permalink
Hide doc outline if there are no headings and use screen reader text.
Browse files Browse the repository at this point in the history
  • Loading branch information
mtias committed Sep 25, 2017
1 parent c739a20 commit 7c35f64
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion editor/document-outline/item.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ const TableOfContentsItem = ( {
<button
className="document-outline__button"
onClick={ onClick }
title={ __( 'Click to focus this heading' ) }
>
<span className="document-outline__emdash" aria-hidden="true"></span>
<strong className="document-outline__level">
Expand All @@ -35,6 +34,7 @@ const TableOfContentsItem = ( {
<span className="document-outline__item-content">
{ children }
</span>
<span className="screen-reader-text">{ __( '(Click to focus this heading)' ) }</span>
</button>
</li>
);
Expand Down
10 changes: 7 additions & 3 deletions editor/table-of-contents/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,13 @@ class TableOfContents extends Component {
{ __( 'Headings' ) }
</div>
</div>
<hr />
<span className="table-of-contents__title">{ __( 'Table of Contents' ) }</span>
<DocumentOutline />
{ headings.length > 0 &&
<div>
<hr />
<span className="table-of-contents__title">{ __( 'Table of Contents' ) }</span>
<DocumentOutline />
</div>
}
</Popover>
</div>
);
Expand Down

0 comments on commit 7c35f64

Please sign in to comment.