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 7, 2024
1 parent f82ed20 commit dc0d00f
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion 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,7 @@ 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 +541,12 @@ 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 Expand Up @@ -763,7 +774,7 @@ class Range extends React.Component {
)}
</div>
{marks !== false && marksPosition === 'below' ? (
<Mark {...commonProps} marks={this._calcMarks()} />
<Mark {...commonProps} marks={this._calcMarks()} />
) : null}
</div>
);
Expand Down

0 comments on commit dc0d00f

Please sign in to comment.