Closed gudh closed 1 year ago
The reason for this is that it's slightly safer / covers more cases. Because of the way the highlights are stored, they are very dependent on the structure of the html, so much so that they can be affected by previous highlights. So if, for example, the first highlight that was done on the page is deleted, then that might cause all the other highlights that were done to break (as in: the extension wouldn't be able to locate their anchor and focus elements). Simply hiding a highlight instead of removing it makes sure that the HTML is unchanged
If we had a better way of serializing highlight locations that is less tightly coupled to the html structure of the page it would be a net benefit as it could make the extension work on more dynamic webpages, but also would allow us to remove highlights instead of simply hiding them as you found here. Here is the issue I have opened for that, I believe there is a way to make this work but it will require significant effort: https://github.com/jeromepl/highlighter/issues/30
https://github.com/jeromepl/highlighter/blob/v4.0.4/src/contentScripts/highlight/remove.js#L13
In
remove.js
, itupdateStorage()
rather thanremoveHighlight()
Is it possible to remove the highlight instead?