Skip to content

Commit

Permalink
fix(Range): add context menu event handling to prevent default behavi…
Browse files Browse the repository at this point in the history
…or, close alibaba-fusion#4768
  • Loading branch information
L0821 committed May 30, 2024
1 parent f82ed20 commit 6ddaeff
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions components/range/view/range.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,10 @@ class Range extends React.Component {
}
}

_onContextMenu(e) {
pauseEvent(e);
}

_start(position) {
this.setState({
hasMovingClass: true,
Expand Down Expand Up @@ -509,6 +513,11 @@ class Range extends React.Component {
_addDocumentMouseEvents() {
this._onMouseMoveListener = events.on(document, 'mousemove', this._move.bind(this));
this._onMouseUpListener = events.on(document, 'mouseup', this._end.bind(this));
this._onContextMenuListener = events.on(
document,
'contextmenu',
this._onContextMenu.bind(this)
);
}

_addDocumentTouchEvents() {
Expand Down Expand Up @@ -536,6 +545,11 @@ class Range extends React.Component {
this._onTouchEndListener.off();
this._onTouchEndListener = null;
}

if (this._onContextMenuListener) {
this._onContextMenuListener.off();
this._onContextMenuListener = null;
}
}

// position => current (value type)
Expand Down

0 comments on commit 6ddaeff

Please sign in to comment.