@gitlab/ui 123.3.0 → 123.3.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.
@@ -324,7 +324,15 @@ var script = {
324
324
  });
325
325
  },
326
326
  handleAutoClose(e) {
327
- if (this.autoClose && e.target.closest(ITEM_SELECTOR) && this.$refs.baseDropdown.containsElement(e.target)) {
327
+ var _this$$refs$baseDropd, _this$$refs$baseDropd2;
328
+ if (this.autoClose && e.target.closest(ITEM_SELECTOR) && // The optional chaining here is to accommodate specs that use shallow mounting.
329
+ // Ideally, those specs would either:
330
+ // - stub out the `BaseDropdown` component to include a stub `containsElement` method, or
331
+ // - use a full mount.
332
+ //
333
+ // Unfortunately, GitLab has many specs which do neither of these. So the simpler thing to do
334
+ // is to optionally chain the method call here.
335
+ (_this$$refs$baseDropd = (_this$$refs$baseDropd2 = this.$refs.baseDropdown).containsElement) !== null && _this$$refs$baseDropd !== void 0 && _this$$refs$baseDropd.call(_this$$refs$baseDropd2, e.target)) {
328
336
  this.closeAndFocus();
329
337
  }
330
338
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "123.3.0",
3
+ "version": "123.3.1",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -120,9 +120,9 @@
120
120
  "@storybook/vue3": "^7.6.20",
121
121
  "@storybook/vue3-webpack5": "^7.6.20",
122
122
  "@types/jest-image-snapshot": "^6.4.0",
123
- "@vue/compat": "^3.5.21",
124
- "@vue/compiler-sfc": "^3.5.21",
125
- "@vue/server-renderer": "^3.5.21",
123
+ "@vue/compat": "^3.5.22",
124
+ "@vue/compiler-sfc": "^3.5.22",
125
+ "@vue/server-renderer": "^3.5.22",
126
126
  "@vue/test-utils": "1.3.6",
127
127
  "@vue/test-utils-vue3": "npm:@vue/test-utils@^2.4.6",
128
128
  "@vue/vue2-jest": "29.2.6",
@@ -347,7 +347,14 @@ export default {
347
347
  if (
348
348
  this.autoClose &&
349
349
  e.target.closest(ITEM_SELECTOR) &&
350
- this.$refs.baseDropdown.containsElement(e.target)
350
+ // The optional chaining here is to accommodate specs that use shallow mounting.
351
+ // Ideally, those specs would either:
352
+ // - stub out the `BaseDropdown` component to include a stub `containsElement` method, or
353
+ // - use a full mount.
354
+ //
355
+ // Unfortunately, GitLab has many specs which do neither of these. So the simpler thing to do
356
+ // is to optionally chain the method call here.
357
+ this.$refs.baseDropdown.containsElement?.(e.target)
351
358
  ) {
352
359
  this.closeAndFocus();
353
360
  }