CIDI / kennethware-2.0

Tools to facilitate rapid course development in Instructure Canvas.
https://usu.instructure.com/courses/305202
GNU Affero General Public License v3.0
39 stars 29 forks source link

Accordions/Tabs created outside kl_wrapper div #14

Closed IUeDS-User closed 9 years ago

IUeDS-User commented 9 years ago

Hi Ken...Came across this recently. When inserting an accordion or tabs widget, the accordion/tab div structure gets created outside the <div id="kl_wrapper"></div> wrapper. Ive tried it with/without themes...always seems to insert the accordion below the kl_wrapper div. Ends up looking something like this:

<div id="kl_wrapper" class="kl_bookmark">&nbsp;</div>
<div class="kl_tabbed_section">
<h4 class="kl_tab_0">Tab 1</h4>
<div id="kl_tab_0" class="kl_tab_content kl_tab_0">
<p>Tab 1 panel contents.</p>
</div>
<h4 class="kl_tab_1">Tab 2</h4>
<div id="kl_tab_1" class="kl_tab_content kl_tab_1">
<p>Tab 2 panel contents.</p>
</div>
</div>
duniken commented 9 years ago

The tabs and accordions are designed to reside within the kl_wrapper and are inserted at the cursor position. It appears that, when the tabs/accordions are placed in a blank page:

  1. It runs a check to see if the kl_wrapper exists (There are several places in the tools that it will check to see if the wrapper exists before creating content).
  2. Finds it does not, so it inserts it at the top of the page
  3. Inserts the tabs/accordion at the cursor position which happens to be outside the wrapper.

The tabs/accordions were not designed to be stand alone items. I originally wrote them to create their own section but discovered that the use cases did not fit that model. They are intended as a way to manage content within a section of the page (preferably with a heading and some sort of explanation as to what the student should do with the information inside of them). I could write code to fix what you mentioned, however I don't feel like these elements should be used in isolation. If you can give me a solid use case for only having a tab/accordion without any other supporting content, I would be willing to put in the effort to change the default behavior. Hopefully that helps.

IUeDS-User commented 9 years ago

Gotcha...we need to create the Section first. I was working with someone who was using a theme, but was placing the cursor outside the theme due to the lack of a content section. This makes sense...thanks.