@canonical/react-components 3.5.0 → 3.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -151,11 +151,18 @@ const ContextualMenu = _ref => {
|
|
|
151
151
|
// becomes smaller.
|
|
152
152
|
closePortal();
|
|
153
153
|
} else {
|
|
154
|
-
//
|
|
155
|
-
//
|
|
156
|
-
|
|
154
|
+
// Only update if the coordinates have changed.
|
|
155
|
+
// The check fixes a bug with chrome, where an input receiving focus and
|
|
156
|
+
// opening the keyboard causes a resize and the keyboard closes right after
|
|
157
|
+
// opening.
|
|
158
|
+
const coords = parent.getBoundingClientRect();
|
|
159
|
+
if (JSON.stringify(coords) !== JSON.stringify(positionCoords)) {
|
|
160
|
+
// Update the coordinates so that the menu stays relative to the
|
|
161
|
+
// toggle button.
|
|
162
|
+
updatePositionCoords();
|
|
163
|
+
}
|
|
157
164
|
}
|
|
158
|
-
}, [closePortal, positionNode, updatePositionCoords]);
|
|
165
|
+
}, [closePortal, positionNode, positionCoords, updatePositionCoords]);
|
|
159
166
|
const onScroll = (0, _react.useCallback)(e => {
|
|
160
167
|
const parent = getPositionNode(wrapper.current, positionNode);
|
|
161
168
|
// update position if the scroll event is triggered by the parent of the menu
|
|
@@ -147,11 +147,18 @@ var ContextualMenu = _ref => {
|
|
|
147
147
|
// becomes smaller.
|
|
148
148
|
closePortal();
|
|
149
149
|
} else {
|
|
150
|
-
//
|
|
151
|
-
//
|
|
152
|
-
|
|
150
|
+
// Only update if the coordinates have changed.
|
|
151
|
+
// The check fixes a bug with chrome, where an input receiving focus and
|
|
152
|
+
// opening the keyboard causes a resize and the keyboard closes right after
|
|
153
|
+
// opening.
|
|
154
|
+
var coords = parent.getBoundingClientRect();
|
|
155
|
+
if (JSON.stringify(coords) !== JSON.stringify(positionCoords)) {
|
|
156
|
+
// Update the coordinates so that the menu stays relative to the
|
|
157
|
+
// toggle button.
|
|
158
|
+
updatePositionCoords();
|
|
159
|
+
}
|
|
153
160
|
}
|
|
154
|
-
}, [closePortal, positionNode, updatePositionCoords]);
|
|
161
|
+
}, [closePortal, positionNode, positionCoords, updatePositionCoords]);
|
|
155
162
|
var onScroll = useCallback(e => {
|
|
156
163
|
var parent = getPositionNode(wrapper.current, positionNode);
|
|
157
164
|
// update position if the scroll event is triggered by the parent of the menu
|