Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some JS events are being dispatched as Royale events but received as native events #1170

Closed
greg-dove opened this issue Dec 19, 2021 · 4 comments
Assignees

Comments

@greg-dove
Copy link
Contributor

Examples are emulation IndexChangedEvent which has a 'change' type and is being sent via the browser dom. This is likely for all sub-classes that have event type names that mean they are routed through the browser dom.

If a Royale event is dispatched, that is what the listener should receive.

@greg-dove greg-dove self-assigned this Dec 19, 2021
@greg-dove greg-dove changed the title Some JS events are being dispatched as Royale events but received and native events Some JS events are being dispatched as Royale events but received as native events Dec 19, 2021
@Harbs
Copy link
Contributor

Harbs commented Dec 19, 2021

Maybe you should add a test that a browser event on an element remains a browser event?

@greg-dove
Copy link
Contributor Author

Maybe you should add a test that a browser event on an element remains a browser event?

Not sure what you mean... how could it be otherwise? By browser event, you mean the native JS 'Event' or 'KeyboardEvent' etc, right? I don't think you can dispatch anything in dom that is not of these known types...

@Harbs
Copy link
Contributor

Harbs commented Dec 19, 2021

Not sure what I mean either, but what happens if it's supposed to on the element and not on the Royale component? Not sure if it makes a difference.

@greg-dove
Copy link
Contributor Author

At the moment there are conversions from browser events into Royale events based on constructor name for things like MouseEvent, KeyboardEvent. These probably only work for browser/user generated events I think.
And for outbound events (dispatched manually from Royale code), if they have an event-type name that is also 'native' (like 'change' or 'mouseup' for example) they are created as native browser events (always 'Event', never anything specific like 'MouseEvent' in this case I think) and sent through the dom. I don't know whether this approach is needed in all cases to create expected behavior or state change in native browser components for example, but that is how it is done currently, and I assume that is the reason behind it. And I haven't changed this behavior. I just added the Royale event to tag along with the browser event so that it can be retrieved for its royale listeners in the listener override.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants