From e5b03488d890a3c289cd06d0e2ab8dd11bbb77ce Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 5 Mar 2021 17:52:51 +0000 Subject: [PATCH] Fix widget resizing There was a line of CSS that set pointer-events: none on widget iframes whilst they were being resized to stop iframes swallowing the mousemove/up events while dragging the resize handle, but a) all widgets are now in a persisted element wrapper and therefore not in the right place in the DOM to get that CSS and b) that only got set when resizing the whole aps drawer vertically, not dragging the handle between apps to change the width distribution. Add a pointer events prop to AppTile to allow the pointer-events style to be set by the parent, and set it when dragging either resize handle. Fixes https://github.com/vector-im/element-web/issues/16473 --- res/css/views/rooms/_AppsDrawer.scss | 5 ----- src/components/views/elements/AppTile.js | 14 ++++++++++---- src/components/views/rooms/AppsDrawer.js | 14 +++++++++++++- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/res/css/views/rooms/_AppsDrawer.scss b/res/css/views/rooms/_AppsDrawer.scss index 492ed95973..fd80836237 100644 --- a/res/css/views/rooms/_AppsDrawer.scss +++ b/res/css/views/rooms/_AppsDrawer.scss @@ -370,11 +370,6 @@ $MinWidth: 240px; display: none; } -/* Avoid apptile iframes capturing mouse event focus when resizing */ -.mx_AppsDrawer_resizing iframe { - pointer-events: none; -} - .mx_AppsDrawer_resizing .mx_AppTile_persistedWrapper { z-index: 1; } diff --git a/src/components/views/elements/AppTile.js b/src/components/views/elements/AppTile.js index 213351889f..747d00a8df 100644 --- a/src/components/views/elements/AppTile.js +++ b/src/components/views/elements/AppTile.js @@ -328,6 +328,10 @@ export default class AppTile extends React.Component { const iframeFeatures = "microphone; camera; encrypted-media; autoplay; display-capture;"; const appTileBodyClass = 'mx_AppTileBody' + (this.props.miniMode ? '_mini ' : ' '); + const appTileBodyStyles = {}; + if (this.props.pointerEvents) { + appTileBodyStyles['pointer-events'] = this.props.pointerEvents; + } const loadingElement = (
@@ -338,7 +342,7 @@ export default class AppTile extends React.Component { // only possible for room widgets, can assert this.props.room here const isEncrypted = MatrixClientPeg.get().isRoomEncrypted(this.props.room.roomId); appTileBody = ( -
+
+
{ loadingElement }
); } else { if (this.isMixedContent()) { appTileBody = ( -
+
); } else { appTileBody = ( -
+
{ this.state.loading && loadingElement }