Inwerpsel / use-theme-editor

A React theme editor
GNU General Public License v3.0
4 stars 0 forks source link

Some clicks inside frame that change page through navigation or display toggle are not reliably prevented on some sites #30

Open Inwerpsel opened 1 year ago

Inwerpsel commented 1 year ago

The current code that intercepts the click to make it inspect the clicked element works in most cases: it reliably prevents actions that would result from the click.

I think that if a site does not include JavaScript (or no click handlers) this reliably works in all cases.

Workaround

Using alt+click to inspect seems to work in all such cases I've seen, probably because it has specific browser behavior by default: download the underlying resource, but can still be overridden.

Unwanted navigation inside frame

It often occurs that within a site links do still result in a navigation of the frame, which currently can break the editor even when you can navigate back.

This can result in 2 things:

Unwanted modification of DOM

For example, the accordion in Bootstrap will toggle on an inspection click, whereas a very similar accordion in CoreUI doesn't.

For this Bootstrap accordion, you do get an inspection matching the latest state. But there's also instances where your inspection is not on the new state (rarer so can't think of an example atm).

How to make this more robust?

Since this depends on many possible variations of markup and scripts of the inspected page, it's probably not possible to make the behavior consistent in 100% of cases. But perhaps more could be done to handle some common cases.

Some instances of this issue are probably caused by anti-patterns, such as using mousedown instead of mouseup.