@atlaskit/tooltip 20.0.5 → 20.0.6

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,13 @@
1
1
  # @atlaskit/tooltip
2
2
 
3
+ ## 20.0.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [#141620](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/141620)
8
+ [`2a925938dea16`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2a925938dea16) -
9
+ [ux] Check focus-visible before showing tooltip on focus events
10
+
3
11
  ## 20.0.5
4
12
 
5
13
  ### 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.0.6"
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.0.6"
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.0.6"
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({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/tooltip",
3
- "version": "20.0.5",
3
+ "version": "20.0.6",
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.8.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.0.0",
67
67
  "@atlaskit/css": "^0.10.0",
68
68
  "@atlaskit/docs": "^10.0.0",
69
- "@atlaskit/icon": "^25.4.0",
69
+ "@atlaskit/icon": "^25.6.0",
70
70
  "@atlaskit/link": "^3.1.0",
71
- "@atlaskit/primitives": "^14.2.0",
71
+ "@atlaskit/primitives": "^14.4.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,9 @@
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"
107
110
  }
108
111
  }
109
112
  }