hyunsupul / aesop-core

Open-sourced suite of components that empower interactive storytelling in WordPress.
http://aesopstoryengine.com
GNU General Public License v2.0
245 stars 56 forks source link

Chapter title attribute on wrong element #318

Closed andywilkerson closed 7 years ago

andywilkerson commented 7 years ago

The attribute data-title is expected to be on the aesop-article-chapter-wrap container but instead was added to the <h2> title element.

Line 177: var title = jQuery(this).find('.aesop-article-chapter-wrap').attr('data-title');

The <h2> title element does not always exist on the page. For example, if a user adds custom "Overlay Text" for a chapter element the title is not include in the page output. Because this data-title attribute is in the wrong place, and sometimes missing entirely, the full title and sub-title text are being applied to the chapter navigation menu. If Overlay Content is added, this full text appears in the chapter navigation menu instead.

This behavior is counter to the description in the help text:

Overlay Content - Text or HTML content to be displayed. You can use tags like H2, H3 etc. Important: If set, it will not show title and subtitle. The chapter menu will still use what you put in for Title.

Regardless of the content entered in the Overlay Content area, the chapter title entered should be used in the navigation. This isn't possible if the data-title attribute is not on the page or applied to the wrong container. Moving the attribute to the expected container fixes the problem.