@atlaskit/emoji 73.6.0 → 73.6.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @atlaskit/emoji
2
2
 
3
+ ## 73.6.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`a91d94fc24642`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a91d94fc24642) -
8
+ Return focus to the productivity colour button after selecting a colour with the keyboard, behind
9
+ the `platform_ally_emoji_fixes_various` feature gate.
10
+ - Updated dependencies
11
+
3
12
  ## 73.6.0
4
13
 
5
14
  ### Minor Changes
@@ -14,6 +14,7 @@ var _runtime = require("@compiled/react/runtime");
14
14
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
15
15
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
16
16
  var _reactIntl = require("react-intl");
17
+ var _browserApis = require("@atlaskit/browser-apis");
17
18
  var _fg = require("@atlaskit/platform-feature-flags/fg");
18
19
  var _constants = require("../../util/constants");
19
20
  var _i18n = require("../i18n");
@@ -118,6 +119,7 @@ var TonesWrapper = function TonesWrapper(props) {
118
119
  var formatMessage = intl.formatMessage;
119
120
  var tonePreviewButtonRef = (0, _react.useRef)(null);
120
121
  var openProductivityColorSelectorWithKeyboard = (0, _react.useRef)(false);
122
+ var productivityColorPopupRef = (0, _react.useRef)(null);
121
123
  var _useState = (0, _react.useState)(false),
122
124
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
123
125
  focusTonePreviewButton = _useState2[0],
@@ -146,9 +148,16 @@ var TonesWrapper = function TonesWrapper(props) {
146
148
  setFocusTonePreviewButton(true);
147
149
  }, [props]);
148
150
  var onProductivityColorSelectedHandler = (0, _react.useCallback)(function (color) {
151
+ var _productivityColorPop, _getDocument$activeEl, _getDocument;
152
+ // colour was selected via keyboard (focus is within the popup), so return focus to the colour button
153
+ // once the popup is closed, otherwise focus is lost when the focused colour option unmounts
154
+ var shouldRestoreFocus = (0, _fg.fg)('platform_ally_emoji_fixes_various') && !!((_productivityColorPop = productivityColorPopupRef.current) !== null && _productivityColorPop !== void 0 && _productivityColorPop.contains((_getDocument$activeEl = (_getDocument = (0, _browserApis.getDocument)()) === null || _getDocument === void 0 ? void 0 : _getDocument.activeElement) !== null && _getDocument$activeEl !== void 0 ? _getDocument$activeEl : null));
149
155
  onProductivityColorSelected === null || onProductivityColorSelected === void 0 || onProductivityColorSelected(color);
150
156
  onToneClose();
151
157
  setFocusSelectedProductivityColorOnMount(false);
158
+ if (shouldRestoreFocus) {
159
+ setFocusTonePreviewButton(true);
160
+ }
152
161
  }, [onProductivityColorSelected, onToneClose]);
153
162
  var onProductivityColorEscape = (0, _react.useCallback)(function () {
154
163
  onToneClose();
@@ -191,6 +200,7 @@ var TonesWrapper = function TonesWrapper(props) {
191
200
  onSelected: onProductivityColorToggle,
192
201
  ariaLabelText: formatMessage(_i18n.messages.emojiSelectColorButtonAriaLabelText)
193
202
  }), showToneSelector && /*#__PURE__*/React.createElement("div", {
203
+ ref: productivityColorPopupRef,
194
204
  className: (0, _runtime.ax)(["_kqswstnw _154i15iq _1xi2idpf _1pbydx66"])
195
205
  }, /*#__PURE__*/React.createElement(ProductivityColorPopupContent, {
196
206
  colorPreviewEmojis: productivityColorPreviewEmojis,
@@ -17,7 +17,7 @@ var createEvent = exports.createEvent = function createEvent(eventType, action,
17
17
  actionSubjectId: actionSubjectId,
18
18
  attributes: _objectSpread({
19
19
  packageName: "@atlaskit/emoji",
20
- packageVersion: "73.5.1"
20
+ packageVersion: "73.6.1"
21
21
  }, attributes)
22
22
  };
23
23
  };
@@ -5,6 +5,7 @@ import * as React from 'react';
5
5
  import { ax, ix } from "@compiled/react/runtime";
6
6
  import { useState, useRef, memo, useLayoutEffect, useCallback, useEffect } from 'react';
7
7
  import { injectIntl } from 'react-intl';
8
+ import { getDocument } from '@atlaskit/browser-apis';
8
9
  import { fg } from '@atlaskit/platform-feature-flags/fg';
9
10
  import { DEFAULT_TONE } from '../../util/constants';
10
11
  import { messages } from '../i18n';
@@ -110,6 +111,7 @@ const TonesWrapper = props => {
110
111
  } = intl;
111
112
  const tonePreviewButtonRef = useRef(null);
112
113
  const openProductivityColorSelectorWithKeyboard = useRef(false);
114
+ const productivityColorPopupRef = useRef(null);
113
115
  const [focusTonePreviewButton, setFocusTonePreviewButton] = useState(false);
114
116
  const [focusSelectedProductivityColorOnMount, setFocusSelectedProductivityColorOnMount] = useState(false);
115
117
  useLayoutEffect(() => {
@@ -136,9 +138,16 @@ const TonesWrapper = props => {
136
138
  setFocusTonePreviewButton(true);
137
139
  }, [props]);
138
140
  const onProductivityColorSelectedHandler = useCallback(color => {
141
+ var _productivityColorPop, _getDocument$activeEl, _getDocument;
142
+ // colour was selected via keyboard (focus is within the popup), so return focus to the colour button
143
+ // once the popup is closed, otherwise focus is lost when the focused colour option unmounts
144
+ const shouldRestoreFocus = fg('platform_ally_emoji_fixes_various') && !!((_productivityColorPop = productivityColorPopupRef.current) !== null && _productivityColorPop !== void 0 && _productivityColorPop.contains((_getDocument$activeEl = (_getDocument = getDocument()) === null || _getDocument === void 0 ? void 0 : _getDocument.activeElement) !== null && _getDocument$activeEl !== void 0 ? _getDocument$activeEl : null));
139
145
  onProductivityColorSelected === null || onProductivityColorSelected === void 0 ? void 0 : onProductivityColorSelected(color);
140
146
  onToneClose();
141
147
  setFocusSelectedProductivityColorOnMount(false);
148
+ if (shouldRestoreFocus) {
149
+ setFocusTonePreviewButton(true);
150
+ }
142
151
  }, [onProductivityColorSelected, onToneClose]);
143
152
  const onProductivityColorEscape = useCallback(() => {
144
153
  onToneClose();
@@ -181,6 +190,7 @@ const TonesWrapper = props => {
181
190
  onSelected: onProductivityColorToggle,
182
191
  ariaLabelText: formatMessage(messages.emojiSelectColorButtonAriaLabelText)
183
192
  }), showToneSelector && /*#__PURE__*/React.createElement("div", {
193
+ ref: productivityColorPopupRef,
184
194
  className: ax(["_kqswstnw _154i15iq _1xi2idpf _1pbydx66"])
185
195
  }, /*#__PURE__*/React.createElement(ProductivityColorPopupContent, {
186
196
  colorPreviewEmojis: productivityColorPreviewEmojis,
@@ -5,7 +5,7 @@ export const createEvent = (eventType, action, actionSubject, actionSubjectId, a
5
5
  actionSubjectId,
6
6
  attributes: {
7
7
  packageName: "@atlaskit/emoji",
8
- packageVersion: "73.5.1",
8
+ packageVersion: "73.6.1",
9
9
  ...attributes
10
10
  }
11
11
  });
@@ -6,6 +6,7 @@ import * as React from 'react';
6
6
  import { ax, ix } from "@compiled/react/runtime";
7
7
  import { useState, useRef, memo, useLayoutEffect, useCallback, useEffect } from 'react';
8
8
  import { injectIntl } from 'react-intl';
9
+ import { getDocument } from '@atlaskit/browser-apis';
9
10
  import { fg } from '@atlaskit/platform-feature-flags/fg';
10
11
  import { DEFAULT_TONE } from '../../util/constants';
11
12
  import { messages } from '../i18n';
@@ -109,6 +110,7 @@ var TonesWrapper = function TonesWrapper(props) {
109
110
  var formatMessage = intl.formatMessage;
110
111
  var tonePreviewButtonRef = useRef(null);
111
112
  var openProductivityColorSelectorWithKeyboard = useRef(false);
113
+ var productivityColorPopupRef = useRef(null);
112
114
  var _useState = useState(false),
113
115
  _useState2 = _slicedToArray(_useState, 2),
114
116
  focusTonePreviewButton = _useState2[0],
@@ -137,9 +139,16 @@ var TonesWrapper = function TonesWrapper(props) {
137
139
  setFocusTonePreviewButton(true);
138
140
  }, [props]);
139
141
  var onProductivityColorSelectedHandler = useCallback(function (color) {
142
+ var _productivityColorPop, _getDocument$activeEl, _getDocument;
143
+ // colour was selected via keyboard (focus is within the popup), so return focus to the colour button
144
+ // once the popup is closed, otherwise focus is lost when the focused colour option unmounts
145
+ var shouldRestoreFocus = fg('platform_ally_emoji_fixes_various') && !!((_productivityColorPop = productivityColorPopupRef.current) !== null && _productivityColorPop !== void 0 && _productivityColorPop.contains((_getDocument$activeEl = (_getDocument = getDocument()) === null || _getDocument === void 0 ? void 0 : _getDocument.activeElement) !== null && _getDocument$activeEl !== void 0 ? _getDocument$activeEl : null));
140
146
  onProductivityColorSelected === null || onProductivityColorSelected === void 0 || onProductivityColorSelected(color);
141
147
  onToneClose();
142
148
  setFocusSelectedProductivityColorOnMount(false);
149
+ if (shouldRestoreFocus) {
150
+ setFocusTonePreviewButton(true);
151
+ }
143
152
  }, [onProductivityColorSelected, onToneClose]);
144
153
  var onProductivityColorEscape = useCallback(function () {
145
154
  onToneClose();
@@ -182,6 +191,7 @@ var TonesWrapper = function TonesWrapper(props) {
182
191
  onSelected: onProductivityColorToggle,
183
192
  ariaLabelText: formatMessage(messages.emojiSelectColorButtonAriaLabelText)
184
193
  }), showToneSelector && /*#__PURE__*/React.createElement("div", {
194
+ ref: productivityColorPopupRef,
185
195
  className: ax(["_kqswstnw _154i15iq _1xi2idpf _1pbydx66"])
186
196
  }, /*#__PURE__*/React.createElement(ProductivityColorPopupContent, {
187
197
  colorPreviewEmojis: productivityColorPreviewEmojis,
@@ -10,7 +10,7 @@ export var createEvent = function createEvent(eventType, action, actionSubject,
10
10
  actionSubjectId: actionSubjectId,
11
11
  attributes: _objectSpread({
12
12
  packageName: "@atlaskit/emoji",
13
- packageVersion: "73.5.1"
13
+ packageVersion: "73.6.1"
14
14
  }, attributes)
15
15
  };
16
16
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/emoji",
3
- "version": "73.6.0",
3
+ "version": "73.6.1",
4
4
  "description": "Fabric emoji React components",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -58,7 +58,7 @@
58
58
  "@atlaskit/tokens": "^20.11.0",
59
59
  "@atlaskit/tooltip": "^24.4.0",
60
60
  "@atlaskit/ufo": "^2.0.0",
61
- "@atlaskit/user-picker": "^14.7.0",
61
+ "@atlaskit/user-picker": "^14.8.0",
62
62
  "@atlaskit/util-service-support": "^7.4.0",
63
63
  "@atlaskit/visually-hidden": "^4.4.0",
64
64
  "@babel/runtime": "^7.0.0",