Attach correct listener based on input

@swatijadhav This should solve the issue you had, by selecting the right event depending on the type. We should likely refactor this in the future so that we have more focused mixins, and avoid branching like that.