@canonical/react-components 3.12.2 → 3.12.4

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.
@@ -120,7 +120,6 @@ const generateLink = (link, key, handleClose) => {
120
120
  return /*#__PURE__*/_react.default.createElement(_Button.default, _extends({
121
121
  className: (0, _classnames.default)("p-contextual-menu__link", className),
122
122
  key: key,
123
- role: "menuitem",
124
123
  onClick: onClick ? evt => {
125
124
  handleClose(evt.nativeEvent);
126
125
  onClick(evt);
@@ -186,7 +186,7 @@ const Tooltip = _ref => {
186
186
  }, [setAdjustedPosition, position]);
187
187
 
188
188
  // Handle mouse events.
189
- (0, _hooks.useListener)(wrapperRef.current, mouseHandler, "mousemove", true, followMouse && isOpen);
189
+ (0, _hooks.useListener)(wrapperRef.current, mouseHandler, "mousemove", true, followMouse);
190
190
 
191
191
  // Handle adjusting the position of the tooltip so that it remains on screen.
192
192
  (0, _hooks.useWindowFitment)(messageRef.current, wrapperRef.current, onUpdateWindowFitment, 20, isOpen, autoAdjust && followMouse);
@@ -220,6 +220,13 @@ const Tooltip = _ref => {
220
220
  e.target.focus();
221
221
  openPortal();
222
222
  };
223
+ const handleFocus = () => {
224
+ if (followMouse && wrapperRef.current) {
225
+ // set initial position for the tooltip
226
+ setPositionStyle(getPositionStyle(adjustedPosition, wrapperRef.current));
227
+ }
228
+ openPortal();
229
+ };
223
230
  const delayedOpenPortal = (0, _react.useCallback)(() => {
224
231
  if (isOpen) {
225
232
  return;
@@ -234,7 +241,7 @@ const Tooltip = _ref => {
234
241
  className: className,
235
242
  onBlur: handleBlur,
236
243
  onClick: handleClick,
237
- onFocus: openPortal,
244
+ onFocus: handleFocus,
238
245
  onMouseOut: handleBlur,
239
246
  onMouseOver: delayedOpenPortal
240
247
  }, /*#__PURE__*/_react.default.createElement("span", {
@@ -114,7 +114,6 @@ var generateLink = (link, key, handleClose) => {
114
114
  return /*#__PURE__*/React.createElement(Button, _extends({
115
115
  className: classNames("p-contextual-menu__link", className),
116
116
  key: key,
117
- role: "menuitem",
118
117
  onClick: onClick ? evt => {
119
118
  handleClose(evt.nativeEvent);
120
119
  onClick(evt);
@@ -177,7 +177,7 @@ var Tooltip = _ref => {
177
177
  }, [setAdjustedPosition, position]);
178
178
 
179
179
  // Handle mouse events.
180
- useListener(wrapperRef.current, mouseHandler, "mousemove", true, followMouse && isOpen);
180
+ useListener(wrapperRef.current, mouseHandler, "mousemove", true, followMouse);
181
181
 
182
182
  // Handle adjusting the position of the tooltip so that it remains on screen.
183
183
  useWindowFitment(messageRef.current, wrapperRef.current, onUpdateWindowFitment, 20, isOpen, autoAdjust && followMouse);
@@ -211,6 +211,13 @@ var Tooltip = _ref => {
211
211
  e.target.focus();
212
212
  openPortal();
213
213
  };
214
+ var handleFocus = () => {
215
+ if (followMouse && wrapperRef.current) {
216
+ // set initial position for the tooltip
217
+ setPositionStyle(getPositionStyle(adjustedPosition, wrapperRef.current));
218
+ }
219
+ openPortal();
220
+ };
214
221
  var delayedOpenPortal = useCallback(() => {
215
222
  if (isOpen) {
216
223
  return;
@@ -225,7 +232,7 @@ var Tooltip = _ref => {
225
232
  className: className,
226
233
  onBlur: handleBlur,
227
234
  onClick: handleClick,
228
- onFocus: openPortal,
235
+ onFocus: handleFocus,
229
236
  onMouseOut: handleBlur,
230
237
  onMouseOver: delayedOpenPortal
231
238
  }, /*#__PURE__*/React.createElement("span", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canonical/react-components",
3
- "version": "3.12.2",
3
+ "version": "3.12.4",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "author": {
@@ -84,7 +84,7 @@
84
84
  "sass": "1.97.2",
85
85
  "sass-loader": "16.0.6",
86
86
  "semantic-release": "25.0.2",
87
- "storybook": "8.6.15",
87
+ "storybook": "8.6.17",
88
88
  "strip-ansi": "7.1.2",
89
89
  "style-loader": "4.0.0",
90
90
  "stylelint": "17.0.0",
@@ -96,7 +96,7 @@
96
96
  "tsc-alias": "1.8.10",
97
97
  "typescript": "5.7.3",
98
98
  "typescript-eslint": "8.24.1",
99
- "vanilla-framework": "4.44.0",
99
+ "vanilla-framework": "4.45.0",
100
100
  "wait-on": "9.0.3",
101
101
  "webpack": "5.105.0"
102
102
  },