chosen
chosen copied to clipboard
Ignore context (right click) mousedown events
Otherwise, the native browser context menu appears on right click of container, and on right click of search result item, AND the default chosen "click" action occurs at the same time, producing an unexpected result for the end-user.
Fixes #949
@alademann any chance you update your PR with the requested changes ?
@stof I made some updates based on your feedback. Added a method that does cross-browser compatible checking of mousedown events so that the boolean logic can check for "is left click" instead of "is not right click".
Please review when you have a chance. Thanks!
@stof - moved the mousedown_checker method as requested.
Wouldn't a function is_left_click suffice? As the others are never considered.
@koenpunt the naming convention of the function I added follows the keydown_checker method - since what we're doing in this case is checking which mousedown event is being fired. Even though the other cases are not considered - I think the way it's currently implemented is more scalable for any additional interactions that may need to check for the type of mousedown event.
I'm happy to change it so that it returns a simple boolean - just throwing it out that its possible the function could be used for other use-cases.