The question goes beyond what the title suggests, but essentially comes down to this issue. Let me provide some context:
In my application, I am utilizing Chromium's rendering/content/javascript engine for user interfaces. Beneath the user interface lies a real 3D world that also requires interaction. You can think of my user interface as a typical HTML page with a transparent body. Therefore, whenever I receive a message for the user interface (such as mouse movements or clicks), I need to determine whether it should be handled by the user interface or passed down to the world "below." This functionality is specific to Chrome and does not need to work in other browsers.
Here are some ideas I've considered so far (using mouse movement as an example):
Attach a mouse move handler to the window (or HTML/body) and deliver the event to the application when triggered. The challenge here is that events propagate up the chain regardless of whether they are handled.
Attach a mouse move handler to the window and check if the event target is HTML or body. The issue arises when hovering over a transparent container div used for layout, as it would intercept the event instead of passing it down.
Attach a mouse move handler to the window and label elements that should not capture the mouse with an attribute. In the handler, verify if the target has this attribute before firing the event. However, this method may miss interactions if the designated element overlaps with another that should capture the mouse.
Attach a mouse move handler to the window and assign the no-mouse attribute to elements that should not capture the mouse. Additionally, add a mouse move handler to all elements lacking this attribute to set a property indicating their intent to capture the event. Then, in the window mouse handler, check for this property in the event object. This approach seems viable, but I welcome suggestions for improvement.
Do you believe my final idea is practical? Are there better strategies for achieving this goal? Thank you in advance for your insights!