Open flygohr opened 5 years ago
Hi @ExoCode17, I'm not sure I understand what the issue is. Are you looking for it to not highlight?
I think the issue (have replicated here in Tiddly Desktop and a browser) is that hovering over the first element in the second tiddler's list also highlights the first element in the first tiddler's list. Worse, clicking the first element of the second tiddler actually checks off an element in the first tiddler :(
steps to replicate:
I think this issue is based on the use of match.index
, in $:/plugins/tgrosinger/tw5-checklist/checkbox-wikirule.js, to link the label
to its checkbox input
element.
More specifically, the id
attribute of the input
element and the for
attribute of the matching label
element are both set to match.index
; this is based on the position of the pattern in the tiddler text. As a result if two tiddlers have a checkbox pattern at the very start, they will both have their first input id and label for set to 0, which confuses the browser for hover or click event handling.
This happens again on line two if the same number of characters is used leading up to the second checkbox pattern in both tiddlers. More generally, this issue will happen any time two checkbox patterns are a the same position (in their respective tiddler text), for two tiddlers that are shown/rendered simultaneously.
As a result, I think it is imprudent to set the id
attribute of the input
element and the for
attribute of the matching label
to a value based on position in text alone. I recommend either using a random value (using Math.random()
) or encoding the tiddler title (which is unique) in addition to the position (concatenate) if that information is available from the wikirule parser (unclear with my limited knowledge).
I implemented the former (using Math.random()
) and that has solved the issue for me.
Not much to say here, attaching a screen: