@atlaskit/dropdown-menu 12.1.2 → 12.1.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/dropdown-menu
2
2
 
3
+ ## 12.1.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [#41898](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/41898) [`b3c84e42159`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b3c84e42159) - Fix loss of autofocus when opening with Enter and Space keys.
8
+
9
+ ## 12.1.3
10
+
11
+ ### Patch Changes
12
+
13
+ - [#41628](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/41628) [`b05664f7aba`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b05664f7aba) - Use feature flag to toggle if we enable UNSAFE_LAYERING
14
+
3
15
  ## 12.1.2
4
16
 
5
17
  ### Patch Changes
@@ -5,7 +5,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.default = void 0;
8
+ exports.default = exports.KEY_SPACE = exports.KEY_ENTER = void 0;
9
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
11
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
@@ -42,6 +42,8 @@ var opposites = {
42
42
  auto: 'auto',
43
43
  end: 'start'
44
44
  };
45
+ var KEY_SPACE = exports.KEY_SPACE = ' ';
46
+ var KEY_ENTER = exports.KEY_ENTER = 'Enter';
45
47
  var getFallbackPlacements = function getFallbackPlacements(placement) {
46
48
  var placementPieces = placement.split('-');
47
49
  var mainAxis = placementPieces[0];
@@ -163,7 +165,8 @@ var DropdownMenu = function DropdownMenu(_ref) {
163
165
  return (0, _bindEventListener.bind)(window, {
164
166
  type: 'keydown',
165
167
  listener: function openOnKeyDown(e) {
166
- if (e.key === _keycodes.KEY_DOWN) {
168
+ // KEY_ENTER and KEY_SPACE are required to correctly recognize the keydown event in Safari
169
+ if (e.key === _keycodes.KEY_DOWN || e.key === KEY_ENTER || e.key === KEY_SPACE) {
167
170
  // prevent page scroll
168
171
  e.preventDefault();
169
172
  handleTriggerClicked(e);
@@ -27,6 +27,8 @@ const opposites = {
27
27
  auto: 'auto',
28
28
  end: 'start'
29
29
  };
30
+ export const KEY_SPACE = ' ';
31
+ export const KEY_ENTER = 'Enter';
30
32
  const getFallbackPlacements = placement => {
31
33
  const placementPieces = placement.split('-');
32
34
  const mainAxis = placementPieces[0];
@@ -134,7 +136,8 @@ const DropdownMenu = ({
134
136
  return bind(window, {
135
137
  type: 'keydown',
136
138
  listener: function openOnKeyDown(e) {
137
- if (e.key === KEY_DOWN) {
139
+ // KEY_ENTER and KEY_SPACE are required to correctly recognize the keydown event in Safari
140
+ if (e.key === KEY_DOWN || e.key === KEY_ENTER || e.key === KEY_SPACE) {
138
141
  // prevent page scroll
139
142
  e.preventDefault();
140
143
  handleTriggerClicked(e);
@@ -33,6 +33,8 @@ var opposites = {
33
33
  auto: 'auto',
34
34
  end: 'start'
35
35
  };
36
+ export var KEY_SPACE = ' ';
37
+ export var KEY_ENTER = 'Enter';
36
38
  var getFallbackPlacements = function getFallbackPlacements(placement) {
37
39
  var placementPieces = placement.split('-');
38
40
  var mainAxis = placementPieces[0];
@@ -154,7 +156,8 @@ var DropdownMenu = function DropdownMenu(_ref) {
154
156
  return bind(window, {
155
157
  type: 'keydown',
156
158
  listener: function openOnKeyDown(e) {
157
- if (e.key === KEY_DOWN) {
159
+ // KEY_ENTER and KEY_SPACE are required to correctly recognize the keydown event in Safari
160
+ if (e.key === KEY_DOWN || e.key === KEY_ENTER || e.key === KEY_SPACE) {
158
161
  // prevent page scroll
159
162
  e.preventDefault();
160
163
  handleTriggerClicked(e);
@@ -1,5 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import type { DropdownMenuProps } from './types';
3
+ export declare const KEY_SPACE = " ";
4
+ export declare const KEY_ENTER = "Enter";
3
5
  /**
4
6
  * __Dropdown menu__
5
7
  *
@@ -1,5 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import type { DropdownMenuProps } from './types';
3
+ export declare const KEY_SPACE = " ";
4
+ export declare const KEY_ENTER = "Enter";
3
5
  /**
4
6
  * __Dropdown menu__
5
7
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/dropdown-menu",
3
- "version": "12.1.2",
3
+ "version": "12.1.4",
4
4
  "description": "A dropdown menu displays a list of actions or options to a user.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -23,18 +23,18 @@
23
23
  }
24
24
  },
25
25
  "dependencies": {
26
- "@atlaskit/button": "^16.10.0",
26
+ "@atlaskit/button": "^16.11.0",
27
27
  "@atlaskit/codemod-utils": "^4.2.0",
28
28
  "@atlaskit/ds-lib": "^2.2.0",
29
29
  "@atlaskit/icon": "^21.12.0",
30
30
  "@atlaskit/layering": "^0.2.0",
31
- "@atlaskit/menu": "^2.0.0",
31
+ "@atlaskit/menu": "^2.1.0",
32
32
  "@atlaskit/platform-feature-flags": "^0.2.2",
33
33
  "@atlaskit/popup": "^1.11.0",
34
34
  "@atlaskit/primitives": "^1.6.0",
35
35
  "@atlaskit/spinner": "^15.6.0",
36
36
  "@atlaskit/theme": "^12.6.0",
37
- "@atlaskit/tokens": "^1.26.0",
37
+ "@atlaskit/tokens": "^1.28.0",
38
38
  "@babel/runtime": "^7.0.0",
39
39
  "@emotion/react": "^11.7.1",
40
40
  "bind-event-listener": "^2.1.1"
@@ -109,7 +109,7 @@
109
109
  "type": "boolean",
110
110
  "referenceOnly": "true"
111
111
  },
112
- "platform.design-system-team.layering_qmiw3": {
112
+ "platform.design-system-team.layering_popup_1cnzt": {
113
113
  "type": "boolean"
114
114
  }
115
115
  },