Fix two bugs in Riot due to a single bug in react-b-dnd

Fixes vector-im/riot-web#6253
Fixes vector-im/riot-web#6156
pull/21833/head
Luke Barnard 2018-02-28 18:31:45 +00:00
parent 1ac62a17ff
commit 64332b3021
2 changed files with 8 additions and 4 deletions

View File

@ -84,7 +84,7 @@ const TagPanel = React.createClass({
} }
}, },
onClick(e) { onMouseDown(e) {
dis.dispatch({action: 'deselect_tags'}); dis.dispatch({action: 'deselect_tags'});
}, },
@ -128,7 +128,9 @@ const TagPanel = React.createClass({
<GeminiScrollbar <GeminiScrollbar
className="mx_TagPanel_scroller" className="mx_TagPanel_scroller"
autoshow={true} autoshow={true}
onClick={this.onClick} // XXX: Use onMouseDown as a workaround for https://github.com/atlassian/react-beautiful-dnd/issues/273
// instead of onClick. Otherwise we experience https://github.com/vector-im/riot-web/issues/6253
onMouseDown={this.onMouseDown}
> >
<Droppable <Droppable
droppableId="tag-panel-droppable" droppableId="tag-panel-droppable"

View File

@ -59,7 +59,7 @@ const GroupTile = React.createClass({
}); });
}, },
onClick: function(e) { onMouseDown: function(e) {
e.preventDefault(); e.preventDefault();
dis.dispatch({ dis.dispatch({
action: 'view_group', action: 'view_group',
@ -79,7 +79,9 @@ const GroupTile = React.createClass({
const httpUrl = profile.avatarUrl ? this.context.matrixClient.mxcUrlToHttp( const httpUrl = profile.avatarUrl ? this.context.matrixClient.mxcUrlToHttp(
profile.avatarUrl, avatarHeight, avatarHeight, "crop", profile.avatarUrl, avatarHeight, avatarHeight, "crop",
) : null; ) : null;
return <AccessibleButton className="mx_GroupTile" onClick={this.onClick}> // XXX: Use onMouseDown as a workaround for https://github.com/atlassian/react-beautiful-dnd/issues/273
// instead of onClick. Otherwise we experience https://github.com/vector-im/riot-web/issues/6156
return <AccessibleButton className="mx_GroupTile" onMouseDown={this.onMouseDown}>
<Droppable droppableId="my-groups-droppable" type="draggable-TagTile"> <Droppable droppableId="my-groups-droppable" type="draggable-TagTile">
{ (droppableProvided, droppableSnapshot) => ( { (droppableProvided, droppableSnapshot) => (
<div ref={droppableProvided.innerRef}> <div ref={droppableProvided.innerRef}>