Skip to content

EventMatcher - separate matching from calling the callback #82

@mwoc

Description

@mwoc

knockout.selection behaves differently if there are zero items to select, it will then not call stopPropagation/preventDefault on events which it would have caught if there were items.

This causes Ctrl+A for example to select random content, while the desired behaviour would be that it in this case does nothing as there are no items.

To tackle this, it would be nice to alter the event handlers which we register, so they check if an event would match before checking if there is an item to call the callback with, and call stopPropagation/preventDefault for all matched events.

I propose modifying the EventMatcher, so that the EventMatcher.match method returns a callback, rather than calling it. The event handler can then call it with an item if there is one.

@bramstein @sunesimonsen @papandreou what's your opinions on that?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions