Make clicking on side panels close settings (mk 3)

Just do it by fixing the somewhat hacky logic to not break if the
target elements also have additional classes, like they do if the
toolbar is showing (I think it turns out this bug is only that it
doesn't work with the toolbar showing...)

Fixes https://github.com/vector-im/riot-web/issues/5658
This commit is contained in:
David Baker 2018-07-27 18:53:36 +01:00
parent 148308235d
commit e059a08d7b

View file

@ -259,12 +259,13 @@ const LoggedInView = React.createClass({
// When the panels are disabled, clicking on them results in a mouse event // When the panels are disabled, clicking on them results in a mouse event
// which bubbles to certain elements in the tree. When this happens, close // which bubbles to certain elements in the tree. When this happens, close
// any settings page that is currently open (user/room/group). // any settings page that is currently open (user/room/group).
const targetClasses = new Set(ev.target.className.split(' '));
if (this.props.leftDisabled && if (this.props.leftDisabled &&
this.props.rightDisabled && this.props.rightDisabled &&
( (
ev.target.className === 'mx_MatrixChat' || targetClasses.has('mx_MatrixChat') ||
ev.target.className === 'mx_MatrixChat_middlePanel' || targetClasses.has('mx_MatrixChat_middlePanel') ||
ev.target.className === 'mx_RoomView' targetClasses.has('mx_RoomView')
) )
) { ) {
dis.dispatch({ action: 'close_settings' }); dis.dispatch({ action: 'close_settings' });