@atlaskit/smart-card 43.26.13 → 43.27.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,12 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 43.27.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`171234137629d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/171234137629d) -
8
+ Open smart hover card on focus
9
+
3
10
  ## 43.26.13
4
11
 
5
12
  ### Patch Changes
@@ -11,7 +11,7 @@ var ANALYTICS_CHANNEL = exports.ANALYTICS_CHANNEL = 'media';
11
11
  var context = exports.context = {
12
12
  componentName: 'smart-cards',
13
13
  packageName: "@atlaskit/smart-card",
14
- packageVersion: "43.26.12"
14
+ packageVersion: "43.26.13"
15
15
  };
16
16
  var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
17
17
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -233,6 +233,12 @@ var HoverCardComponent = exports.HoverCardComponent = function HoverCardComponen
233
233
  source: HOVER_CARD_SOURCE
234
234
  }, /*#__PURE__*/_react.default.createElement(_HoverCardContent.default, hoverCardContentProps));
235
235
  }, [initShowCard, initHideCard, linkState, onActionClick, renderers, actionOptions, url, id, hoverPreviewOptions]);
236
+ var handleKeyDown = (0, _react.useCallback)(function (e) {
237
+ if (e.key === ' ') {
238
+ e.preventDefault();
239
+ initShowCard(e);
240
+ }
241
+ }, [initShowCard]);
236
242
  var trigger = (0, _react.useCallback)(function (_ref3) {
237
243
  var _ariaHasPopup = _ref3['aria-haspopup'],
238
244
  _ariaExpanded = _ref3['aria-expanded'],
@@ -246,13 +252,14 @@ var HoverCardComponent = exports.HoverCardComponent = function HoverCardComponen
246
252
  ,
247
253
  onMouseLeave: initHideCard,
248
254
  onMouseMove: setMousePosition,
255
+ onKeyDown: (0, _platformFeatureFlags.fg)('fix_hover_card_on_focus_a11y') ? handleKeyDown : undefined,
249
256
  onClick: onChildClick,
250
257
  onContextMenu: onContextMenuClick,
251
258
  "data-testid": HOVER_CARD_TRIGGER_WRAPPER
252
259
  }, (0, _experiments.editorExperiment)('platform_editor_preview_panel_linking_exp', true) ? {
253
260
  className: HOVER_CARD_TRIGGER_WRAPPER
254
261
  } : {}), children));
255
- }, [children, initHideCard, initShowCard, onChildClick, onContextMenuClick, setMousePosition]);
262
+ }, [children, initHideCard, initShowCard, onChildClick, onContextMenuClick, setMousePosition, handleKeyDown]);
256
263
  var popupComponent = (0, _react.useMemo)(
257
264
  // Within the Popup component, if shouldRenderToParent, the zIndex prop is ignored
258
265
  // as it is assumed that the custom popup container has the desired styles
@@ -262,7 +269,7 @@ var HoverCardComponent = exports.HoverCardComponent = function HoverCardComponen
262
269
  return /*#__PURE__*/_react.default.createElement(_popup.default, {
263
270
  testId: "hover-card",
264
271
  isOpen: isOpen && canOpen,
265
- onClose: hideCard,
272
+ onClose: (0, _platformFeatureFlags.fg)('fix_hover_card_on_focus_a11y') ? initHideCard : hideCard,
266
273
  placement: "bottom-start",
267
274
  offset: popupOffset.current,
268
275
  autoFocus: false,
@@ -22,7 +22,7 @@ var _excluded = ["href", "children", "checkSafety", "onClick", "testId", "isLink
22
22
  _excluded2 = ["isLinkSafe", "showSafetyWarningModal"];
23
23
  var PACKAGE_DATA = {
24
24
  packageName: "@atlaskit/smart-card",
25
- packageVersion: "43.26.12",
25
+ packageVersion: "43.26.13",
26
26
  componentName: 'linkUrl'
27
27
  };
28
28
  var Anchor = (0, _click.withLinkClickedEvent)('a');
@@ -2,7 +2,7 @@ export const ANALYTICS_CHANNEL = 'media';
2
2
  export const context = {
3
3
  componentName: 'smart-cards',
4
4
  packageName: "@atlaskit/smart-card",
5
- packageVersion: "43.26.12"
5
+ packageVersion: "43.26.13"
6
6
  };
7
7
  export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
8
8
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -207,6 +207,12 @@ export const HoverCardComponent = ({
207
207
  source: HOVER_CARD_SOURCE
208
208
  }, /*#__PURE__*/React.createElement(HoverCardContent, hoverCardContentProps));
209
209
  }, [initShowCard, initHideCard, linkState, onActionClick, renderers, actionOptions, url, id, hoverPreviewOptions]);
210
+ const handleKeyDown = useCallback(e => {
211
+ if (e.key === ' ') {
212
+ e.preventDefault();
213
+ initShowCard(e);
214
+ }
215
+ }, [initShowCard]);
210
216
  const trigger = useCallback(({
211
217
  'aria-haspopup': _ariaHasPopup,
212
218
  'aria-expanded': _ariaExpanded,
@@ -220,12 +226,13 @@ export const HoverCardComponent = ({
220
226
  ,
221
227
  onMouseLeave: initHideCard,
222
228
  onMouseMove: setMousePosition,
229
+ onKeyDown: fg('fix_hover_card_on_focus_a11y') ? handleKeyDown : undefined,
223
230
  onClick: onChildClick,
224
231
  onContextMenu: onContextMenuClick,
225
232
  "data-testid": HOVER_CARD_TRIGGER_WRAPPER
226
233
  }, editorExperiment('platform_editor_preview_panel_linking_exp', true) ? {
227
234
  className: HOVER_CARD_TRIGGER_WRAPPER
228
- } : {}), children)), [children, initHideCard, initShowCard, onChildClick, onContextMenuClick, setMousePosition]);
235
+ } : {}), children)), [children, initHideCard, initShowCard, onChildClick, onContextMenuClick, setMousePosition, handleKeyDown]);
229
236
  const popupComponent = useMemo(
230
237
  // Within the Popup component, if shouldRenderToParent, the zIndex prop is ignored
231
238
  // as it is assumed that the custom popup container has the desired styles
@@ -233,7 +240,7 @@ export const HoverCardComponent = ({
233
240
  return /*#__PURE__*/React.createElement(Popup, {
234
241
  testId: "hover-card",
235
242
  isOpen: isOpen && canOpen,
236
- onClose: hideCard,
243
+ onClose: fg('fix_hover_card_on_focus_a11y') ? initHideCard : hideCard,
237
244
  placement: "bottom-start",
238
245
  offset: popupOffset.current,
239
246
  autoFocus: false,
@@ -12,7 +12,7 @@ import LinkWarningModal from './LinkWarningModal';
12
12
  import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
13
13
  const PACKAGE_DATA = {
14
14
  packageName: "@atlaskit/smart-card",
15
- packageVersion: "43.26.12",
15
+ packageVersion: "43.26.13",
16
16
  componentName: 'linkUrl'
17
17
  };
18
18
  const Anchor = withLinkClickedEvent('a');
@@ -4,7 +4,7 @@ export var ANALYTICS_CHANNEL = 'media';
4
4
  export var context = {
5
5
  componentName: 'smart-cards',
6
6
  packageName: "@atlaskit/smart-card",
7
- packageVersion: "43.26.12"
7
+ packageVersion: "43.26.13"
8
8
  };
9
9
  export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
10
10
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -224,6 +224,12 @@ export var HoverCardComponent = function HoverCardComponent(_ref) {
224
224
  source: HOVER_CARD_SOURCE
225
225
  }, /*#__PURE__*/React.createElement(HoverCardContent, hoverCardContentProps));
226
226
  }, [initShowCard, initHideCard, linkState, onActionClick, renderers, actionOptions, url, id, hoverPreviewOptions]);
227
+ var handleKeyDown = useCallback(function (e) {
228
+ if (e.key === ' ') {
229
+ e.preventDefault();
230
+ initShowCard(e);
231
+ }
232
+ }, [initShowCard]);
227
233
  var trigger = useCallback(function (_ref3) {
228
234
  var _ariaHasPopup = _ref3['aria-haspopup'],
229
235
  _ariaExpanded = _ref3['aria-expanded'],
@@ -237,13 +243,14 @@ export var HoverCardComponent = function HoverCardComponent(_ref) {
237
243
  ,
238
244
  onMouseLeave: initHideCard,
239
245
  onMouseMove: setMousePosition,
246
+ onKeyDown: fg('fix_hover_card_on_focus_a11y') ? handleKeyDown : undefined,
240
247
  onClick: onChildClick,
241
248
  onContextMenu: onContextMenuClick,
242
249
  "data-testid": HOVER_CARD_TRIGGER_WRAPPER
243
250
  }, editorExperiment('platform_editor_preview_panel_linking_exp', true) ? {
244
251
  className: HOVER_CARD_TRIGGER_WRAPPER
245
252
  } : {}), children));
246
- }, [children, initHideCard, initShowCard, onChildClick, onContextMenuClick, setMousePosition]);
253
+ }, [children, initHideCard, initShowCard, onChildClick, onContextMenuClick, setMousePosition, handleKeyDown]);
247
254
  var popupComponent = useMemo(
248
255
  // Within the Popup component, if shouldRenderToParent, the zIndex prop is ignored
249
256
  // as it is assumed that the custom popup container has the desired styles
@@ -253,7 +260,7 @@ export var HoverCardComponent = function HoverCardComponent(_ref) {
253
260
  return /*#__PURE__*/React.createElement(Popup, {
254
261
  testId: "hover-card",
255
262
  isOpen: isOpen && canOpen,
256
- onClose: hideCard,
263
+ onClose: fg('fix_hover_card_on_focus_a11y') ? initHideCard : hideCard,
257
264
  placement: "bottom-start",
258
265
  offset: popupOffset.current,
259
266
  autoFocus: false,
@@ -15,7 +15,7 @@ import LinkWarningModal from './LinkWarningModal';
15
15
  import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
16
16
  var PACKAGE_DATA = {
17
17
  packageName: "@atlaskit/smart-card",
18
- packageVersion: "43.26.12",
18
+ packageVersion: "43.26.13",
19
19
  componentName: 'linkUrl'
20
20
  };
21
21
  var Anchor = withLinkClickedEvent('a');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "43.26.13",
3
+ "version": "43.27.0",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -229,6 +229,9 @@
229
229
  },
230
230
  "jpx-1074-smart-links-iframe": {
231
231
  "type": "boolean"
232
+ },
233
+ "fix_hover_card_on_focus_a11y": {
234
+ "type": "boolean"
232
235
  }
233
236
  },
234
237
  "compassUnitTestMetricSourceId": "ari:cloud:compass:a436116f-02ce-4520-8fbb-7301462a1674:metric-source/c5751cc6-3513-4070-9deb-af31e86aed34/f74ef1bc-7240-4aac-9dc8-9dc43b502089"