-
-
Notifications
You must be signed in to change notification settings - Fork 102
Fix pat-autotoc fieldset ID and refactor TOC navigation
#1479
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
I was also not aware that there are tests that are checking for the fieldset ids :) Also, refactored parts looks good and easier to read. Thanks @petschki |
|
OK, somehow this autotoc implementation confused me ... sorted some things for clarification: The old "autotab" implementation iterates over the
A bit strange, that the Now we have the Bootstrap markup implementation (https://getbootstrap.com/docs/5.3/components/navs-tabs/#javascript-behavior) ... we need to add things like So this markup <form>
<fieldset id="fieldset-default">
<legend id="fieldsetlegend-default">Default</legend>
</fieldset>
</form>should end in <form>
<nav>
<ul class="nav nav-tabs" id="myTab" role="tablist">
<li class="nav-item" role="presentation">
<a href="#fieldset-default" class="nav-link active" id="autotoc-item-autotoc-0-tab" data-bs-toggle="tab" data-bs-target="#fieldset-default" role="tab" aria-controls="fieldset-default" aria-selected="true">Default</button>
</li>
</ul>
</nav>
<div class="tab-content" id="myTabContent">
<fieldset class="tab-pane fade show active" id="fieldset-default" role="tabpanel" aria-labelledby="autotoc-item-autotoc-0-tab" tabindex="0">...</div>
</div>
<form>Thats straight forward, but currently, there are also robottests which rely on the "old" autogenerated paneID selector (see https://github.com/plone/Products.CMFPlone/blob/master/Products/CMFPlone/tests/robot/test_contentbrowser.robot#L126) which needs to be changed accordingly (/cc @1letter) Theres one more thing: this old issue with the nested tabs and non-unique ID problem #1242 ... maybe someone has an idea how we could handle this? |
|
I have here a Draft PR for robottest fixes. But i would wait for the final markup decision and implementation. |
99dcae5 to
f233fe1
Compare
|
I have now reverted the autotoc merge and released mockup 5.4.2 ... this branch is now rebased with the changes from #1468 and I will continue to work on the autotoc fixes. staticresources with the tinymce fixes from #1476 will get released soon when plone/plone.staticresources#385 is green. |
3861537 to
5643a5d
Compare
|
I've now refactored this a bit to not break the current id generation. Regarding nested autotocs: this is not easy to solve automaticall inside the pattern, because the pattern parsing goes "inside out" -> the deepest pattern gets rendered first. So we do not know in which section of the parent autotoc pattern we are and cannot generate a unique ID accordingly. The |
303e2f5 to
b7ffd36
Compare
|
As usual: the new autotoc implementation had some sideeffects on schemaeditor ... see luckily there were some robottests which complained ;) |
faeea17 to
afc6ed5
Compare
|
@petschki I can see that your last commits fixes the fieldset ids' problem. Old fieldset ids' are kept and they are correctly linked from the tabs 🎊 About nested autotocs: I have also tried to implement the prefix solution by adding the elements' index but the browser hashes are indeed not working on the nested elements. I have realized this problem after adding the commit 🤯, thus I have removed this commit but basically if was like the following:
|
afc6ed5 to
b7ffd36
Compare
|
@cihanandac I have a basic idea how to solve this. It will work if we add the parent tabID to the But this means, that we need the parent tabID in the For example the theming controlpanel could then look like this:
If we update the options here https://github.com/plone/plone.app.theming/blob/master/src/plone/app/theming/browser/controlpanel.pt#L336 to when you then click on the subitem the browser hash is |
| // NOTE: if you have nested autotocs then you have to add the | ||
| // parent autotoc tabId to `options.IDPrefix` of the sub autotoc | ||
| // in order to mark parent and sub tab as active. | ||
| if (activeId === null && (window.location.hash.indexOf(tabHash) == 0 || $level.hasClass(self.options.classActiveName))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cihanandac this solves the nested tab activation problem. however, we need to fix the IDPrefix of theming controlpanel before we merge this, otherwise you cannot access the subtabs anymore.
b9ef05e to
5789758
Compare
5789758 to
103fa15
Compare


@cihanandac I had to refactor the id generation because I've overseen that the PR #1468 rewrites the
fieldsetids with auto-generated values (which we only want if we have vertical TOC or colliding fieldset Ids) ... see https://jenkins.plone.org/job/pull-request-6.1-3.10/974/ for robot test details, which depend on various fieldset Ids (eg#fieldset-settings)