@atlaskit/navigation-system 2.5.0 → 2.6.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,13 @@
1
1
  # @atlassian/navigation-system
2
2
 
3
+ ## 2.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`e9ddf34435a22`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e9ddf34435a22) -
8
+ Clicking dropdown menu items will no longer collapse the side navigation on mobile. This change is
9
+ behind a feature flag.
10
+
3
11
  ## 2.5.0
4
12
 
5
13
  ### Minor Changes
@@ -342,6 +342,15 @@ function SideNavInternal(_ref) {
342
342
  // Ignore if our element references are invalid
343
343
  return;
344
344
  }
345
+ if (!event.target.isConnected && (0, _platformFeatureFlags.fg)('platform_dst_nav4_side_nav_click_outside_fix')) {
346
+ /**
347
+ * If the element that was clicked is no longer in the document, we should not collapse the side nav.
348
+ * This can happen when the user clicks on a dropdown menu item (such as one used in a `...` More menu),
349
+ * as the dropdown menu will close after being clicked. By the time this event listener runs, the clicked
350
+ * element will no longer be in the document, so the check below for `sideNav.contains(event.target)` will fail.
351
+ */
352
+ return;
353
+ }
345
354
  if (sideNav.contains(event.target)) {
346
355
  // Clicks inside the side nav should not close it
347
356
  return;
@@ -327,6 +327,15 @@ function SideNavInternal({
327
327
  // Ignore if our element references are invalid
328
328
  return;
329
329
  }
330
+ if (!event.target.isConnected && fg('platform_dst_nav4_side_nav_click_outside_fix')) {
331
+ /**
332
+ * If the element that was clicked is no longer in the document, we should not collapse the side nav.
333
+ * This can happen when the user clicks on a dropdown menu item (such as one used in a `...` More menu),
334
+ * as the dropdown menu will close after being clicked. By the time this event listener runs, the clicked
335
+ * element will no longer be in the document, so the check below for `sideNav.contains(event.target)` will fail.
336
+ */
337
+ return;
338
+ }
330
339
  if (sideNav.contains(event.target)) {
331
340
  // Clicks inside the side nav should not close it
332
341
  return;
@@ -333,6 +333,15 @@ function SideNavInternal(_ref) {
333
333
  // Ignore if our element references are invalid
334
334
  return;
335
335
  }
336
+ if (!event.target.isConnected && fg('platform_dst_nav4_side_nav_click_outside_fix')) {
337
+ /**
338
+ * If the element that was clicked is no longer in the document, we should not collapse the side nav.
339
+ * This can happen when the user clicks on a dropdown menu item (such as one used in a `...` More menu),
340
+ * as the dropdown menu will close after being clicked. By the time this event listener runs, the clicked
341
+ * element will no longer be in the document, so the check below for `sideNav.contains(event.target)` will fail.
342
+ */
343
+ return;
344
+ }
336
345
  if (sideNav.contains(event.target)) {
337
346
  // Clicks inside the side nav should not close it
338
347
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/navigation-system",
3
- "version": "2.5.0",
3
+ "version": "2.6.0",
4
4
  "description": "The latest navigation system for Atlassian apps.",
5
5
  "repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
6
6
  "author": "Atlassian Pty Ltd",
@@ -184,6 +184,9 @@
184
184
  },
185
185
  "platform_dst_nav4_menu_section_heading_a11y": {
186
186
  "type": "boolean"
187
+ },
188
+ "platform_dst_nav4_side_nav_click_outside_fix": {
189
+ "type": "boolean"
187
190
  }
188
191
  },
189
192
  "homepage": "https://atlassian.design/components/navigation-system"