@atlaskit/tooltip 20.0.5 → 20.1.0

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @atlaskit/tooltip
2
2
 
3
+ ## 20.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#161235](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/161235)
8
+ [`cfa80fa55b0d6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/cfa80fa55b0d6) -
9
+ The `truncate` prop has been marked as deprecated, as it is inaccessible. It will be be removed in
10
+ a future release.
11
+
12
+ ## 20.0.6
13
+
14
+ ### Patch Changes
15
+
16
+ - [#141620](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/141620)
17
+ [`2a925938dea16`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2a925938dea16) -
18
+ [ux] Check focus-visible before showing tooltip on focus events
19
+
3
20
  ## 20.0.5
4
21
 
5
22
  ### Patch Changes
@@ -34,7 +34,7 @@ var tooltipZIndex = _constants.layers.tooltip();
34
34
  var analyticsAttributes = {
35
35
  componentName: 'tooltip',
36
36
  packageName: "@atlaskit/tooltip",
37
- packageVersion: "20.0.5"
37
+ packageVersion: "20.1.0"
38
38
  };
39
39
 
40
40
  // Inverts motion direction
@@ -375,6 +375,17 @@ function Tooltip(_ref) {
375
375
  }
376
376
  }, []);
377
377
  var onFocus = (0, _react.useCallback)(function () {
378
+ // Check if focus-visible
379
+ // Prevents tooltips from showing when focus is not visible,
380
+ // i.e., when focus is moved onto tooltip trigger inside a popup on open
381
+ try {
382
+ if (targetRef.current && !targetRef.current.matches(':focus-visible') && (0, _platformFeatureFlags.fg)('platform-tooltip-focus-visible')) {
383
+ return;
384
+ }
385
+ } catch (_) {
386
+ // Ignore errors from environments that don't support :focus-visible
387
+ }
388
+
378
389
  // TODO: this does not play well with `hideTooltipOnMouseDown`
379
390
  // as "focus" will occur after the "mousedown".
380
391
  tryShowTooltip({
@@ -20,7 +20,7 @@ const tooltipZIndex = layers.tooltip();
20
20
  const analyticsAttributes = {
21
21
  componentName: 'tooltip',
22
22
  packageName: "@atlaskit/tooltip",
23
- packageVersion: "20.0.5"
23
+ packageVersion: "20.1.0"
24
24
  };
25
25
 
26
26
  // Inverts motion direction
@@ -350,6 +350,17 @@ function Tooltip({
350
350
  }
351
351
  }, []);
352
352
  const onFocus = useCallback(() => {
353
+ // Check if focus-visible
354
+ // Prevents tooltips from showing when focus is not visible,
355
+ // i.e., when focus is moved onto tooltip trigger inside a popup on open
356
+ try {
357
+ if (targetRef.current && !targetRef.current.matches(':focus-visible') && fg('platform-tooltip-focus-visible')) {
358
+ return;
359
+ }
360
+ } catch (_) {
361
+ // Ignore errors from environments that don't support :focus-visible
362
+ }
363
+
353
364
  // TODO: this does not play well with `hideTooltipOnMouseDown`
354
365
  // as "focus" will occur after the "mousedown".
355
366
  tryShowTooltip({
@@ -24,7 +24,7 @@ var tooltipZIndex = layers.tooltip();
24
24
  var analyticsAttributes = {
25
25
  componentName: 'tooltip',
26
26
  packageName: "@atlaskit/tooltip",
27
- packageVersion: "20.0.5"
27
+ packageVersion: "20.1.0"
28
28
  };
29
29
 
30
30
  // Inverts motion direction
@@ -365,6 +365,17 @@ function Tooltip(_ref) {
365
365
  }
366
366
  }, []);
367
367
  var onFocus = useCallback(function () {
368
+ // Check if focus-visible
369
+ // Prevents tooltips from showing when focus is not visible,
370
+ // i.e., when focus is moved onto tooltip trigger inside a popup on open
371
+ try {
372
+ if (targetRef.current && !targetRef.current.matches(':focus-visible') && fg('platform-tooltip-focus-visible')) {
373
+ return;
374
+ }
375
+ } catch (_) {
376
+ // Ignore errors from environments that don't support :focus-visible
377
+ }
378
+
368
379
  // TODO: this does not play well with `hideTooltipOnMouseDown`
369
380
  // as "focus" will occur after the "mousedown".
370
381
  tryShowTooltip({
@@ -104,7 +104,11 @@ export interface TooltipProps {
104
104
  ref: React.Ref<HTMLElement>;
105
105
  }> | React.ForwardRefExoticComponent<React.PropsWithoutRef<React.AllHTMLAttributes<HTMLElement>> & React.RefAttributes<HTMLElement>>;
106
106
  /**
107
- * Use this to show only one line of text, and truncate the text when it's too long. We no longer support truncating text in the tooltip as it's inaccessible, and this will be removed in a future release.
107
+ * Use this to show only one line of text, and truncate the text when it's too long.
108
+ *
109
+ * We no longer support truncating text in the tooltip as it's inaccessible, and this prop will be removed in a future release.
110
+ *
111
+ * @deprecated
108
112
  */
109
113
  truncate?: boolean;
110
114
  /**
@@ -104,7 +104,11 @@ export interface TooltipProps {
104
104
  ref: React.Ref<HTMLElement>;
105
105
  }> | React.ForwardRefExoticComponent<React.PropsWithoutRef<React.AllHTMLAttributes<HTMLElement>> & React.RefAttributes<HTMLElement>>;
106
106
  /**
107
- * Use this to show only one line of text, and truncate the text when it's too long. We no longer support truncating text in the tooltip as it's inaccessible, and this will be removed in a future release.
107
+ * Use this to show only one line of text, and truncate the text when it's too long.
108
+ *
109
+ * We no longer support truncating text in the tooltip as it's inaccessible, and this prop will be removed in a future release.
110
+ *
111
+ * @deprecated
108
112
  */
109
113
  truncate?: boolean;
110
114
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/tooltip",
3
- "version": "20.0.5",
3
+ "version": "20.1.0",
4
4
  "description": "A tooltip is a floating, non-actionable label used to explain a user interface element or feature.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -49,7 +49,7 @@
49
49
  "@atlaskit/popper": "^7.0.0",
50
50
  "@atlaskit/portal": "^5.1.0",
51
51
  "@atlaskit/theme": "^18.0.0",
52
- "@atlaskit/tokens": "^4.5.0",
52
+ "@atlaskit/tokens": "^4.9.0",
53
53
  "@babel/runtime": "^7.0.0",
54
54
  "@compiled/react": "^0.18.3",
55
55
  "@emotion/react": "^11.7.1",
@@ -60,15 +60,15 @@
60
60
  "react-dom": "^18.2.0"
61
61
  },
62
62
  "devDependencies": {
63
- "@af/accessibility-testing": "^2.0.0",
64
- "@af/integration-testing": "^0.5.0",
65
- "@af/visual-regression": "^1.3.0",
66
- "@atlaskit/button": "^22.0.0",
63
+ "@af/accessibility-testing": "workspace:^",
64
+ "@af/integration-testing": "workspace:^",
65
+ "@af/visual-regression": "workspace:^",
66
+ "@atlaskit/button": "^23.2.0",
67
67
  "@atlaskit/css": "^0.10.0",
68
68
  "@atlaskit/docs": "^10.0.0",
69
- "@atlaskit/icon": "^25.4.0",
70
- "@atlaskit/link": "^3.1.0",
71
- "@atlaskit/primitives": "^14.2.0",
69
+ "@atlaskit/icon": "^26.3.0",
70
+ "@atlaskit/link": "^3.2.0",
71
+ "@atlaskit/primitives": "^14.8.0",
72
72
  "@atlaskit/section-message": "^8.2.0",
73
73
  "@atlassian/ssr-tests": "^0.2.0",
74
74
  "@testing-library/react": "^13.4.0",
@@ -104,6 +104,13 @@
104
104
  "platform-feature-flags": {
105
105
  "platform_dst_open_layer_observer_close_layers": {
106
106
  "type": "boolean"
107
+ },
108
+ "platform-tooltip-focus-visible": {
109
+ "type": "boolean"
110
+ },
111
+ "platform-component-visual-refresh": {
112
+ "type": "boolean",
113
+ "referenceOnly": true
107
114
  }
108
115
  }
109
116
  }