From 150a0807410daaa3b8168a06cb5749674b2cbf89 Mon Sep 17 00:00:00 2001 From: Iftekhar Rifat Date: Mon, 10 Apr 2017 18:16:39 +0600 Subject: [PATCH] Disable context menu in timepicker's up & down arrow Right now, right clicking on up or down arrow starts the counter while also showing the default context menu for browsers. This commit disables the context menu & makes the right click behavior identical to left click. --- src/TimeView.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/TimeView.js b/src/TimeView.js index 54887e2fb..d41df2f7c 100644 --- a/src/TimeView.js +++ b/src/TimeView.js @@ -57,9 +57,9 @@ var DateTimePickerTime = onClickOutside( React.createClass({ } } return DOM.div({ key: type, className: 'rdtCounter' }, [ - DOM.span({ key: 'up', className: 'rdtBtn', onMouseDown: this.onStartClicking( 'increase', type ) }, '▲' ), + DOM.span({ key: 'up', className: 'rdtBtn', onMouseDown: this.onStartClicking( 'increase', type ), onContextMenu: this.disableContextMenu }, '▲' ), DOM.div({ key: 'c', className: 'rdtCount' }, value ), - DOM.span({ key: 'do', className: 'rdtBtn', onMouseDown: this.onStartClicking( 'decrease', type ) }, '▼' ) + DOM.span({ key: 'do', className: 'rdtBtn', onMouseDown: this.onStartClicking( 'decrease', type ), onContextMenu: this.disableContextMenu }, '▼' ) ]); } return ''; @@ -67,9 +67,9 @@ var DateTimePickerTime = onClickOutside( React.createClass({ renderDayPart: function() { return DOM.div({ key: 'dayPart', className: 'rdtCounter' }, [ - DOM.span({ key: 'up', className: 'rdtBtn', onMouseDown: this.onStartClicking( 'toggleDayPart', 'hours') }, '▲' ), + DOM.span({ key: 'up', className: 'rdtBtn', onMouseDown: this.onStartClicking( 'toggleDayPart', 'hours'), onContextMenu: this.disableContextMenu }, '▲' ), DOM.div({ key: this.state.daypart, className: 'rdtCount' }, this.state.daypart ), - DOM.span({ key: 'do', className: 'rdtBtn', onMouseDown: this.onStartClicking( 'toggleDayPart', 'hours') }, '▼' ) + DOM.span({ key: 'do', className: 'rdtBtn', onMouseDown: this.onStartClicking( 'toggleDayPart', 'hours'), onContextMenu: this.disableContextMenu }, '▼' ) ]); }, @@ -185,6 +185,11 @@ var DateTimePickerTime = onClickOutside( React.createClass({ }; }, + disableContextMenu: function(event) { + event.preventDefault(); + return false; + }, + padValues: { hours: 1, minutes: 2,