@atlaskit/popup 2.0.1 → 2.0.2

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/popup
2
2
 
3
+ ## 2.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#121410](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/121410)
8
+ [`b26d53ac2517a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b26d53ac2517a) -
9
+ Prevent onClick handler gets called when popup is open on Firefox
10
+
3
11
  ## 2.0.1
4
12
 
5
13
  ### Patch Changes
@@ -188,16 +188,32 @@ var useCloseManager = exports.useCloseManager = function useCloseManager(_ref) {
188
188
  }
189
189
  });
190
190
  }
191
- var unbind = (0, _bindEventListener.bindAll)(window, [{
192
- type: 'click',
193
- listener: onClick,
194
- options: {
195
- capture: capture
196
- }
197
- }, {
198
- type: 'keydown',
199
- listener: onKeyDown
200
- }]);
191
+ var unbind = _noop.default;
192
+ if ((0, _platformFeatureFlags.fg)('popup-onclose-fix')) {
193
+ setTimeout(function () {
194
+ unbind = (0, _bindEventListener.bindAll)(window, [{
195
+ type: 'click',
196
+ listener: onClick,
197
+ options: {
198
+ capture: capture
199
+ }
200
+ }, {
201
+ type: 'keydown',
202
+ listener: onKeyDown
203
+ }]);
204
+ }, 0);
205
+ } else {
206
+ unbind = (0, _bindEventListener.bindAll)(window, [{
207
+ type: 'click',
208
+ listener: onClick,
209
+ options: {
210
+ capture: capture
211
+ }
212
+ }, {
213
+ type: 'keydown',
214
+ listener: onKeyDown
215
+ }]);
216
+ }
201
217
 
202
218
  // bind onBlur event listener to fix popup not close when clicking on iframe outside
203
219
  var unbindBlur = _noop.default;
@@ -212,8 +228,14 @@ var useCloseManager = exports.useCloseManager = function useCloseManager(_ref) {
212
228
  });
213
229
  return function () {
214
230
  var _parentUnbind;
231
+ if ((0, _platformFeatureFlags.fg)('popup-onclose-fix')) {
232
+ setTimeout(function () {
233
+ unbind();
234
+ }, 0);
235
+ } else {
236
+ unbind();
237
+ }
215
238
  cancelAllFrames();
216
- unbind();
217
239
  (_parentUnbind = parentUnbind) === null || _parentUnbind === void 0 || _parentUnbind();
218
240
  unbindBlur();
219
241
  };
@@ -189,16 +189,32 @@ export const useCloseManager = ({
189
189
  }
190
190
  });
191
191
  }
192
- const unbind = bindAll(window, [{
193
- type: 'click',
194
- listener: onClick,
195
- options: {
196
- capture
197
- }
198
- }, {
199
- type: 'keydown',
200
- listener: onKeyDown
201
- }]);
192
+ let unbind = noop;
193
+ if (fg('popup-onclose-fix')) {
194
+ setTimeout(() => {
195
+ unbind = bindAll(window, [{
196
+ type: 'click',
197
+ listener: onClick,
198
+ options: {
199
+ capture
200
+ }
201
+ }, {
202
+ type: 'keydown',
203
+ listener: onKeyDown
204
+ }]);
205
+ }, 0);
206
+ } else {
207
+ unbind = bindAll(window, [{
208
+ type: 'click',
209
+ listener: onClick,
210
+ options: {
211
+ capture
212
+ }
213
+ }, {
214
+ type: 'keydown',
215
+ listener: onKeyDown
216
+ }]);
217
+ }
202
218
 
203
219
  // bind onBlur event listener to fix popup not close when clicking on iframe outside
204
220
  let unbindBlur = noop;
@@ -213,8 +229,14 @@ export const useCloseManager = ({
213
229
  });
214
230
  return () => {
215
231
  var _parentUnbind;
232
+ if (fg('popup-onclose-fix')) {
233
+ setTimeout(() => {
234
+ unbind();
235
+ }, 0);
236
+ } else {
237
+ unbind();
238
+ }
216
239
  cancelAllFrames();
217
- unbind();
218
240
  (_parentUnbind = parentUnbind) === null || _parentUnbind === void 0 ? void 0 : _parentUnbind();
219
241
  unbindBlur();
220
242
  };
@@ -180,16 +180,32 @@ export var useCloseManager = function useCloseManager(_ref) {
180
180
  }
181
181
  });
182
182
  }
183
- var unbind = bindAll(window, [{
184
- type: 'click',
185
- listener: onClick,
186
- options: {
187
- capture: capture
188
- }
189
- }, {
190
- type: 'keydown',
191
- listener: onKeyDown
192
- }]);
183
+ var unbind = noop;
184
+ if (fg('popup-onclose-fix')) {
185
+ setTimeout(function () {
186
+ unbind = bindAll(window, [{
187
+ type: 'click',
188
+ listener: onClick,
189
+ options: {
190
+ capture: capture
191
+ }
192
+ }, {
193
+ type: 'keydown',
194
+ listener: onKeyDown
195
+ }]);
196
+ }, 0);
197
+ } else {
198
+ unbind = bindAll(window, [{
199
+ type: 'click',
200
+ listener: onClick,
201
+ options: {
202
+ capture: capture
203
+ }
204
+ }, {
205
+ type: 'keydown',
206
+ listener: onKeyDown
207
+ }]);
208
+ }
193
209
 
194
210
  // bind onBlur event listener to fix popup not close when clicking on iframe outside
195
211
  var unbindBlur = noop;
@@ -204,8 +220,14 @@ export var useCloseManager = function useCloseManager(_ref) {
204
220
  });
205
221
  return function () {
206
222
  var _parentUnbind;
223
+ if (fg('popup-onclose-fix')) {
224
+ setTimeout(function () {
225
+ unbind();
226
+ }, 0);
227
+ } else {
228
+ unbind();
229
+ }
207
230
  cancelAllFrames();
208
- unbind();
209
231
  (_parentUnbind = parentUnbind) === null || _parentUnbind === void 0 || _parentUnbind();
210
232
  unbindBlur();
211
233
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/popup",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "description": "A popup displays brief content in an overlay.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -47,7 +47,7 @@
47
47
  "@atlaskit/portal": "^5.0.0",
48
48
  "@atlaskit/primitives": "^14.1.0",
49
49
  "@atlaskit/theme": "^17.0.0",
50
- "@atlaskit/tokens": "^4.2.0",
50
+ "@atlaskit/tokens": "^4.3.0",
51
51
  "@babel/runtime": "^7.0.0",
52
52
  "@emotion/react": "^11.7.1",
53
53
  "bind-event-listener": "^3.0.0",
@@ -130,6 +130,9 @@
130
130
  },
131
131
  "fix-dropdown-close-outside-iframe": {
132
132
  "type": "boolean"
133
+ },
134
+ "popup-onclose-fix": {
135
+ "type": "boolean"
133
136
  }
134
137
  },
135
138
  "homepage": "https://atlassian.design/components/popup/"