Przeglądaj źródła

fix(context-menu) Add max height (#10965)

factor2
Robert Pintilii 3 lat temu
rodzic
commit
9062c91d77
No account linked to committer's email address

+ 7
- 2
react/features/base/components/context-menu/ContextMenu.js Wyświetl plik

@@ -67,6 +67,8 @@ type Props = {
67 67
     onMouseLeave?: Function
68 68
 };
69 69
 
70
+const MAX_HEIGHT = 400;
71
+
70 72
 const useStyles = makeStyles(theme => {
71 73
     return {
72 74
         contextMenu: {
@@ -80,7 +82,9 @@ const useStyles = makeStyles(theme => {
80 82
             position: 'absolute',
81 83
             right: `${participantsPaneTheme.panePadding}px`,
82 84
             top: 0,
83
-            zIndex: 2
85
+            zIndex: 2,
86
+            maxHeight: `${MAX_HEIGHT}px`,
87
+            overflowY: 'auto'
84 88
         },
85 89
 
86 90
         contextMenuHidden: {
@@ -136,8 +140,9 @@ const ContextMenu = ({
136 140
             const { current: container } = containerRef;
137 141
             const { offsetTop, offsetParent: { offsetHeight, scrollTop } } = offsetTarget;
138 142
             const outerHeight = getComputedOuterHeight(container);
143
+            const height = Math.min(MAX_HEIGHT, outerHeight);
139 144
 
140
-            container.style.top = offsetTop + outerHeight > offsetHeight + scrollTop
145
+            container.style.top = offsetTop + height > offsetHeight + scrollTop
141 146
                 ? `${offsetTop - outerHeight}`
142 147
                 : `${offsetTop}`;
143 148
 

Ładowanie…
Anuluj
Zapisz