Skip to content

Support custom non-standard DOM events #4645

Closed

Description

@Gozala

Please add support for custom non-standard DOM events, ideally through a public API but if that's a "no go" at least some way that would not require forking the code base.

Here is my attempt of exposing non-standard events after getting some insights on IRC, unfortunately it still does not work (as event listeners are not registered) and I am not sure if there is more whitelists somewhere that skips those custom events:
https://gist.github.com/Gozala/a977973957fcee9c5671

P.S.: Any help in changing this snippet to make it work is also greatly appreciated

Activity

  1. daukantas commented on Aug 17, 2015

    @daukantas

    I hereby add my support to custom non-standard DOM events.

  2. louisremi commented on Sep 4, 2015

    @louisremi

    I recommend taking inspiration from the battle-tested special event API of jQuery. It has allowed devs to both normalize events across browsers (wheel events for example), and support new kind of events such as triple click (not saying this one's a good idea).

  3. Gozala commented on Sep 11, 2015

    @Gozala
    Author

    Is there any chance to get any kind of feedback on this ?

  4. rpominov commented on Sep 11, 2015

    @rpominov
    Contributor

    This may be related #4751

  5. sebmarkbage commented on Sep 14, 2015

    @sebmarkbage
    Contributor

    This has been asked for many times before. See discussion in #4751.

    It might make sense to allow any function to pass through and become a "simple event plugin" by default. That way there is no whitelist necessarily. This would make it a breaking change if we ever added custom logic to that particular event. Which we likely will. However, that's the stance we've already taking with other attributes in general.

  6. Gozala commented on Sep 14, 2015

    @Gozala
    Author

    It might make sense to allow any function to pass through and become a "simple event plugin" by default. That way there is no whitelist necessarily. This would make it a breaking change if we ever added custom logic to that particular event. Which we likely will. However, that's the stance we've already taking with other attributes in general.

    You could require a specific "simple event plugin" to avoid breaking changes, which could be as simple as:

    html.div({ onClick: handleSyntheticClick, onNativeClick: handleNativeClick })

    Or more complex but robust as:

    html.div({
      onClick: handleSyntheticClick,
      [React.on('click')]: handleNativeClick
    })
  7. nhunzaker commented on Oct 23, 2016

    @nhunzaker
    Contributor

    @sebmarkbage Sort of spurred by #7901, but I've been wanting custom events for a while and had some prior work stripping out the attribute whitelist to support custom attributes (#7311).

    So I took a stab:
    nhunzaker#2

    I've PR'ed this to myself (against #7311). I'm hesitant to submit a PR against another PR, but I think I'm happy with it. There was a lot of event name munging already happening, I was able to lower that, move most of it to a central location, and lean on the existing SimpleEventPlugin as you'd suggested.

    Does this feel like the right track?

  8. nhunzaker commented on Jul 11, 2017

    @nhunzaker
    Contributor

    We have a few duplicates of this issue, so I'm closing it out. This should land with #7311

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions