Closed Puddinglord closed 3 years ago
My first guess is that those elements that have mouseenter/mouseleave events handlers are removed from the DOM then added back when a highlight is applied (which means they would lose the event handlers attached to them). This happens because when a highlight is applied the subsection of the DOM that it is in is replaced by a copy that contains the DOM element(s) of that highlight. I'll check why this is happening even when highlighting a completely different section of the page...
To be clear, I never highlight those words as they already have color and call attention to themselves.
Thanks for looking into this 🙏
An update on this issue: the problem was indeed the one I identified and I am currently working on a fix. For documentation purposes: the fix is to edit the DOM in-place instead of editing an html string which creates a copy of the DOM elements thus removing any attached event handlers. This fix is also a nice software quality improvement that I already had plans to do. The last hurdle to getting this pushed right now is to ensure backwards compatibility with previous versions of this extension, specifically with highlights that users had highlighted over (which used to un-highlight the selected text). This is more difficult to achieve in-place in the DOM, as the html string technique had the advantage that a trick of interchanging the start and end delimiters was enough to perform this "un-highlighting".
This makes sense and I'm glad a solution was able to be found! Thanks for your effort on this and I excitedly await the update 🥳
This should be out in a couple of days, I have just submitted a new version of the extension containing this change for review on the chrome web store
Hey the review for the update was finally done but was rejected. I'll have to contest it but in the meantime if you want to use this feature I encourage you to clone this repo and load it "Unpacked" in your browser at chrome://extensions/
Epic 👏 I shall clone and pull it down. Thanks for all the work you've done, I appreciate it.
When using this extension on D&D Beyond if I make a highlight then all of their hover tooltips stop working. Any ideas on this and how to prevent it from doing that?
For example, go to this page: https://www.dndbeyond.com/sources/basic-rules/combat and scroll down until you see either a bold green word or red words and hover your mouse over them. Above your mouse, you should see a box that floats over the page with information in it. If you then highlight a word with this extension and then try to hover over the colored word you first hovered over you'll see that the tooltip/card doesn't popup anymore.
Let me know if there's any more information I can provide or if you could point me in the right direction on solving this issue.
Thanks, Dakotah