From 57da29de5899fc638e00ba328438581abb369f02 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Mon, 8 Jan 2024 12:11:44 +0000 Subject: [PATCH] Fix regression around CSS stacking contexts and PIP widgets (#12094) * Fix CSS stacking contexts for Dialogs & PersistedElement Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Switch to PersistedElement sharing a CSS stacking context for z-index to continue functioning Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Fix Widget PIP overlay being under the widget and dragging being broken Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Fix border-radius on widget pip Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Fix majority of tests Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Fix jest retryTimes applying outside of CI Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Fix remaining tests Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Fix React unique key warnings Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Fix sticker picker Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * id not class Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Fix widget pip button colour in light theme Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Revert unrelated change Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- res/css/_common.pcss | 6 ++- res/css/components/views/pips/_WidgetPip.pcss | 21 ++++++-- res/css/views/rooms/_AppsDrawer.pcss | 3 ++ src/components/structures/PipContainer.tsx | 2 + src/components/views/elements/AppTile.tsx | 27 +++++----- .../views/elements/PersistedElement.tsx | 15 +++++- .../views/elements/PersistentApp.tsx | 1 + src/components/views/pips/WidgetPip.tsx | 49 ++++++++++--------- .../structures/PipContainer-test.tsx | 22 +++++++-- 9 files changed, 101 insertions(+), 45 deletions(-) diff --git a/res/css/_common.pcss b/res/css/_common.pcss index 8eed973e75..7979a04e34 100644 --- a/res/css/_common.pcss +++ b/res/css/_common.pcss @@ -56,8 +56,10 @@ limitations under the License. /* This is required to ensure Compound tooltips correctly draw where they should with z-index: auto */ contain: strict; } -.mx_Dialog_StaticContainer, -.mx_Dialog_Container { +#mx_ContextualMenu_Container, +#mx_PersistedElement_container, +#mx_Dialog_Container, +#mx_Dialog_StaticContainer { /* This is required to ensure Compound tooltips correctly draw where they should with z-index: auto */ isolation: isolate; } diff --git a/res/css/components/views/pips/_WidgetPip.pcss b/res/css/components/views/pips/_WidgetPip.pcss index f6bf5a2a63..bc0419a493 100644 --- a/res/css/components/views/pips/_WidgetPip.pcss +++ b/res/css/components/views/pips/_WidgetPip.pcss @@ -14,11 +14,21 @@ See the License for the specific language governing permissions and limitations under the License. */ +$width: 320px; +$height: 220px; + .mx_WidgetPip { - width: 320px; - height: 220px; + width: $width; + height: $height; +} + +.mx_WidgetPip_overlay { + width: $width; + height: $height; + position: absolute; + top: 0; border-radius: 8px; - contain: paint; + overflow: hidden; color: $call-primary-content; cursor: pointer; } @@ -31,8 +41,11 @@ limitations under the License. width: 100%; box-sizing: border-box; transition: opacity ease 0.15s; +} - .mx_WidgetPip:not(:hover) > & { +.mx_WidgetPip_overlay:not(:hover) { + .mx_WidgetPip_header, + .mx_WidgetPip_footer { opacity: 0; } } diff --git a/res/css/views/rooms/_AppsDrawer.pcss b/res/css/views/rooms/_AppsDrawer.pcss index 99d64739fa..fc59568322 100644 --- a/res/css/views/rooms/_AppsDrawer.pcss +++ b/res/css/views/rooms/_AppsDrawer.pcss @@ -325,6 +325,9 @@ limitations under the License. &.mx_AppTileBody--call { border-radius: 0px; } + &.mx_AppTileBody--call.mx_AppTileBody--mini { + border-radius: 8px; + } } /* appTileBody is embedded to PersistedElement outside of mx_AppTile, diff --git a/src/components/structures/PipContainer.tsx b/src/components/structures/PipContainer.tsx index 6f249fd677..a7676f5bbc 100644 --- a/src/components/structures/PipContainer.tsx +++ b/src/components/structures/PipContainer.tsx @@ -305,6 +305,7 @@ class PipContainerInner extends React.Component { const call = this.state.primaryCall; pipContent.push(({ onStartMoving, onResize }) => ( { if (this.state.showWidgetInPip && this.state.persistentWidgetId) { pipContent.push(({ onStartMoving }) => ( void) | undefined>; + // An element to render after the iframe as an overlay + overlay?: ReactNode; } interface IState { @@ -663,17 +665,20 @@ export default class AppTile extends React.Component { ); } else { appTileBody = ( -
- {this.state.loading && loadingElement} -