Pārlūkot izejas kodu

fix(Thumbnail, Drawer): Remove hover state; Prevent outside propagation

master
Mihai-Andrei Uscat 3 gadus atpakaļ
vecāks
revīzija
b7ab3ea052

+ 13
- 1
css/_drawer.scss Parādīt failu

@@ -4,16 +4,28 @@
4 4
     right: 0;
5 5
     bottom: 0;
6 6
     z-index: $drawerZ;
7
-    background-color: #141414;
8 7
     border-radius: 16px 16px 0 0;
9 8
 }
10 9
 
10
+.drawer-portal::after {
11
+    content: '';
12
+    background-color: $participantsPaneBgColor;
13
+    margin-bottom: env(safe-area-inset-bottom, 0);
14
+}
15
+
16
+.drawer-menu-container {
17
+    height: 100vh;
18
+    display: flex;
19
+    align-items: flex-end;
20
+}
21
+
11 22
 .drawer-menu {
12 23
     max-height: calc(80vh - 64px);
13 24
     background: #242528;
14 25
     border-radius: 16px 16px 0 0;
15 26
     overflow-y: hidden;
16 27
     margin-bottom: env(safe-area-inset-bottom, 0);
28
+    width: 100%;
17 29
 
18 30
     .drawer-toggle {
19 31
         display: flex;

+ 38
- 19
react/features/filmstrip/components/web/Thumbnail.js Parādīt failu

@@ -2,10 +2,10 @@
2 2
 
3 3
 import React, { Component } from 'react';
4 4
 
5
-import { isMobileBrowser } from '../../../../../react/features/base/environment/utils';
6 5
 import { createScreenSharingIssueEvent, sendAnalytics } from '../../../analytics';
7 6
 import { AudioLevelIndicator } from '../../../audio-level-indicator';
8 7
 import { Avatar } from '../../../base/avatar';
8
+import { isMobileBrowser } from '../../../base/environment/utils';
9 9
 import JitsiMeetJS from '../../../base/lib-jitsi-meet/_';
10 10
 import { MEDIA_TYPE, VideoTrack } from '../../../base/media';
11 11
 import {
@@ -139,6 +139,11 @@ export type Props = {|
139 139
      */
140 140
     _isCurrentlyOnLargeVideo: boolean,
141 141
 
142
+    /**
143
+     * Whether we are currently running in a mobile browser.
144
+     */
145
+    _isMobile: boolean,
146
+
142 147
     /**
143 148
      * Indicates whether the participant is screen sharing.
144 149
      */
@@ -612,7 +617,7 @@ class Thumbnail extends Component<Props, State> {
612 617
      * @returns {ReactElement}
613 618
      */
614 619
     _renderFakeParticipant() {
615
-        const { _participant: { avatarURL } } = this.props;
620
+        const { _isMobile, _participant: { avatarURL } } = this.props;
616 621
         const styles = this._getStyles();
617 622
         const containerClassName = this._getContainerClassName();
618 623
 
@@ -621,8 +626,10 @@ class Thumbnail extends Component<Props, State> {
621 626
                 className = { containerClassName }
622 627
                 id = 'sharedVideoContainer'
623 628
                 onClick = { this._onClick }
624
-                onMouseEnter = { this._onMouseEnter }
625
-                onMouseLeave = { this._onMouseLeave }
629
+                { ...(_isMobile ? {} : {
630
+                    onMouseEnter: this._onMouseEnter,
631
+                    onMouseLeave: this._onMouseLeave
632
+                }) }
626 633
                 style = { styles.thumbnail }>
627 634
                 {avatarURL ? (
628 635
                     <img
@@ -753,6 +760,7 @@ class Thumbnail extends Component<Props, State> {
753 760
         const {
754 761
             _defaultLocalDisplayName,
755 762
             _disableLocalVideoFlip,
763
+            _isMobile,
756 764
             _isScreenSharing,
757 765
             _localFlipX,
758 766
             _disableProfile,
@@ -772,13 +780,17 @@ class Thumbnail extends Component<Props, State> {
772 780
                 className = { containerClassName }
773 781
                 id = 'localVideoContainer'
774 782
                 onClick = { this._onClick }
775
-                onMouseEnter = { this._onMouseEnter }
776
-                onMouseLeave = { this._onMouseLeave }
777
-                { ...(isMobileBrowser() ? {
778
-                    onTouchEnd: this._onTouchEnd,
779
-                    onTouchMove: this._onTouchMove,
780
-                    onTouchStart: this._onTouchStart
781
-                } : {}) }
783
+                { ...(_isMobile
784
+                    ? {
785
+                        onTouchEnd: this._onTouchEnd,
786
+                        onTouchMove: this._onTouchMove,
787
+                        onTouchStart: this._onTouchStart
788
+                    }
789
+                    : {
790
+                        onMouseEnter: this._onMouseEnter,
791
+                        onMouseLeave: this._onMouseLeave
792
+                    }
793
+                ) }
782 794
                 style = { styles.thumbnail }>
783 795
                 <div className = 'videocontainer__background' />
784 796
                 <span id = 'localVideoWrapper'>
@@ -875,6 +887,7 @@ class Thumbnail extends Component<Props, State> {
875 887
      */
876 888
     _renderRemoteParticipant() {
877 889
         const {
890
+            _isMobile,
878 891
             _isTestModeEnabled,
879 892
             _participant,
880 893
             _startSilent,
@@ -909,13 +922,17 @@ class Thumbnail extends Component<Props, State> {
909 922
                 className = { containerClassName }
910 923
                 id = { `participant_${id}` }
911 924
                 onClick = { this._onClick }
912
-                onMouseEnter = { this._onMouseEnter }
913
-                onMouseLeave = { this._onMouseLeave }
914
-                { ...(isMobileBrowser() ? {
915
-                    onTouchEnd: this._onTouchEnd,
916
-                    onTouchMove: this._onTouchMove,
917
-                    onTouchStart: this._onTouchStart
918
-                } : {}) }
925
+                { ...(_isMobile
926
+                    ? {
927
+                        onTouchEnd: this._onTouchEnd,
928
+                        onTouchMove: this._onTouchMove,
929
+                        onTouchStart: this._onTouchStart
930
+                    }
931
+                    : {
932
+                        onMouseEnter: this._onMouseEnter,
933
+                        onMouseLeave: this._onMouseLeave
934
+                    }
935
+                ) }
919 936
                 style = { styles.thumbnail }>
920 937
                 {
921 938
                     _videoTrack && <VideoTrack
@@ -1031,6 +1048,7 @@ function _mapStateToProps(state, ownProps): Object {
1031 1048
     } = state['features/base/config'];
1032 1049
     const { NORMAL = 8 } = interfaceConfig.INDICATOR_FONT_SIZES || {};
1033 1050
     const { localFlipX } = state['features/base/settings'];
1051
+    const _isMobile = isMobileBrowser();
1034 1052
 
1035 1053
 
1036 1054
     switch (_currentLayout) {
@@ -1072,7 +1090,7 @@ function _mapStateToProps(state, ownProps): Object {
1072 1090
     return {
1073 1091
         _audioTrack,
1074 1092
         _connectionIndicatorAutoHideEnabled: interfaceConfig.CONNECTION_INDICATOR_AUTO_HIDE_ENABLED,
1075
-        _connectionIndicatorDisabled: isMobileBrowser() || interfaceConfig.CONNECTION_INDICATOR_DISABLED,
1093
+        _connectionIndicatorDisabled: _isMobile || interfaceConfig.CONNECTION_INDICATOR_DISABLED,
1076 1094
         _currentLayout,
1077 1095
         _defaultLocalDisplayName: interfaceConfig.DEFAULT_LOCAL_DISPLAY_NAME,
1078 1096
         _disableLocalVideoFlip: Boolean(disableLocalVideoFlip),
@@ -1081,6 +1099,7 @@ function _mapStateToProps(state, ownProps): Object {
1081 1099
         _isAudioOnly: Boolean(state['features/base/audio-only'].enabled),
1082 1100
         _isCurrentlyOnLargeVideo: state['features/large-video']?.participantId === id,
1083 1101
         _isDominantSpeakerDisabled: interfaceConfig.DISABLE_DOMINANT_SPEAKER_INDICATOR,
1102
+        _isMobile,
1084 1103
         _isScreenSharing: _videoTrack?.videoType === 'desktop',
1085 1104
         _isTestModeEnabled: isTestModeEnabled(state),
1086 1105
         _isVideoPlayable: id && isVideoPlayable(state, id),

+ 23
- 21
react/features/toolbox/components/web/Drawer.js Parādīt failu

@@ -1,6 +1,6 @@
1 1
 // @flow
2 2
 
3
-import React, { useEffect, useRef } from 'react';
3
+import React, { useCallback } from 'react';
4 4
 
5 5
 
6 6
 type Props = {
@@ -30,36 +30,38 @@ function Drawer({
30 30
     children,
31 31
     isOpen,
32 32
     onClose }: Props) {
33
-    const drawerRef: Object = useRef(null);
34 33
 
35 34
     /**
36
-     * Closes the drawer when clicking or touching outside of it.
35
+     * Handles clicks within the menu, preventing the propagation of the click event.
37 36
      *
38
-     * @param {Event} event - Mouse down/start touch event object.
37
+     * @param {Object} event - The click event.
39 38
      * @returns {void}
40 39
      */
41
-    function handleOutsideClickOrTouch(event: Event) {
42
-        if (drawerRef.current && !drawerRef.current.contains(event.target)) {
43
-            onClose();
44
-        }
45
-    }
40
+    const handleInsideClick = useCallback(event => {
41
+        event.stopPropagation();
42
+    }, []);
46 43
 
47
-    useEffect(() => {
48
-        window.addEventListener('mousedown', handleOutsideClickOrTouch);
49
-        window.addEventListener('touchstart', handleOutsideClickOrTouch);
50
-
51
-        return () => {
52
-            window.removeEventListener('mousedown', handleOutsideClickOrTouch);
53
-            window.removeEventListener('touchstart', handleOutsideClickOrTouch);
54
-        };
55
-    }, [ drawerRef ]);
44
+    /**
45
+     * Handles clicks outside of the menu, closing it, and also stopping further propagation.
46
+     *
47
+     * @param {Object} event - The click event.
48
+     * @returns {void}
49
+     */
50
+    const handleOutsideClick = useCallback(event => {
51
+        event.stopPropagation();
52
+        onClose();
53
+    }, [ onClose ]);
56 54
 
57 55
     return (
58 56
         isOpen ? (
59 57
             <div
60
-                className = 'drawer-menu'
61
-                ref = { drawerRef }>
62
-                {children}
58
+                className = 'drawer-menu-container'
59
+                onClick = { handleOutsideClick }>
60
+                <div
61
+                    className = 'drawer-menu'
62
+                    onClick = { handleInsideClick }>
63
+                    {children}
64
+                </div>
63 65
             </div>
64 66
         ) : null
65 67
     );

Notiek ielāde…
Atcelt
Saglabāt