-
Notifications
You must be signed in to change notification settings - Fork 138
Description
Tell us about your environment
- MarkBind Version: 2.8.0
What did you do? Please include the actual source code causing the issue.
Is the current behaviour of header indexing in panels intended?
When there is no header
specified, and there is a slot="header"
specified with some level of markdown heading inside, there are two cases:
expanded
is specified : the heading is indexed, as expected, but there are now two identicalids
in the dom (one for thecardContainer
, the other from theslot
. ( not that its really an issue ) ( point 1 )expanded
is not specified: the slot heading is not indexed ( This leads to point2
below ), and there are still two identicalids
.
On the other hand, if a header
is specified for the panel
, then the code to search for another header in the headerWrapper
will not execute ( second branch in mounted()
).
mounted()
in PanelBase.js
...
} else if (this.$refs.headerWrapper.innerHTML) {
const header = jQuery(this.$refs.headerWrapper.innerHTML).wrap('<div</div>').parent().find(':header');
if (header.length > 0) {
this.$refs.cardContainer.setAttribute('id', header[0].id);
}
}
- If said
header
is not a md header (### ...
), then the code will not execute ( with no implications, as far as I can see ) ( point 1 ) - The behaviour for the
slot header
is similar to above, barring the duplicateid
( since the second branch inmounted()
is no longer executed ).- if
unexpanded
, the heading will not be indexed - if
expanded
is specified, and theheader="..."
is a valid md header, then the slot header, along with the overwrittenheader
are indexed. ( point 3 )
- if
What did you expect to happen?
- It seems that the second branch is unnecessary, and it would only result in a duplicate id currently. ( I might be missing something )
Sample code producing the issue ( no header
attribute, so the second branch is executed ):
<panel type="info">
<div slot="header">
# some header
</div>
.........
</panel>
Result (duplicate ids) (removing the second branch in mounted()
only removes the id from the cardContainer, which dosen't break the anchor since there is still one in the heading.
- The slot heading is not indexed when
expanded
is not specified.
Result from the same code for point 1: ( adding expanded
resolves it )
- The overwritten
header
is indexed along with theslot header
. Should the hiddenheader="..."
be indexed in this case?
Sample code producing the issue: ( only the slot header is displayed since it takes priority, but both are indexed as seen in the second screenshot )
<panel type="info" header="# another header" expanded>
<div slot="header">
# some header
</div>
.........
</panel>