@atlaskit/navigation-system 2.4.1 → 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,21 @@
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
+
11
+ ## 2.5.0
12
+
13
+ ### Minor Changes
14
+
15
+ - [`f506e887c7e55`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f506e887c7e55) -
16
+ Cleans up `platform_design_system_nav4_panel_default_border` feature flag. The `Panel` slot will
17
+ have a border by default.
18
+
3
19
  ## 2.4.1
4
20
 
5
21
  ### Patch Changes
@@ -63,7 +63,7 @@ function Panel(_ref) {
63
63
  providedId = _ref.id,
64
64
  xcss = _ref.xcss,
65
65
  _ref$hasBorder = _ref.hasBorder,
66
- hasBorder = _ref$hasBorder === void 0 ? (0, _platformFeatureFlags.fg)('platform_design_system_nav4_panel_default_border') : _ref$hasBorder;
66
+ hasBorder = _ref$hasBorder === void 0 ? true : _ref$hasBorder;
67
67
  var dangerouslyHoistSlotSizes = (0, _react.useContext)(_hoistSlotSizesContext.DangerouslyHoistSlotSizes);
68
68
  var id = (0, _idUtils.useLayoutId)({
69
69
  providedId: providedId
@@ -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;
@@ -48,7 +48,7 @@ export function Panel({
48
48
  testId,
49
49
  id: providedId,
50
50
  xcss,
51
- hasBorder = fg('platform_design_system_nav4_panel_default_border')
51
+ hasBorder = true
52
52
  }) {
53
53
  const dangerouslyHoistSlotSizes = useContext(DangerouslyHoistSlotSizes);
54
54
  const id = useLayoutId({
@@ -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;
@@ -54,7 +54,7 @@ export function Panel(_ref) {
54
54
  providedId = _ref.id,
55
55
  xcss = _ref.xcss,
56
56
  _ref$hasBorder = _ref.hasBorder,
57
- hasBorder = _ref$hasBorder === void 0 ? fg('platform_design_system_nav4_panel_default_border') : _ref$hasBorder;
57
+ hasBorder = _ref$hasBorder === void 0 ? true : _ref$hasBorder;
58
58
  var dangerouslyHoistSlotSizes = useContext(DangerouslyHoistSlotSizes);
59
59
  var id = useLayoutId({
60
60
  providedId: providedId
@@ -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;
@@ -32,9 +32,9 @@ export declare function Panel({ children, defaultWidth: defaultWidthProp, label,
32
32
  /**
33
33
  * Whether or not the slot has its own border. On small screens this becomes a shadow.
34
34
  *
35
- * Defaults to the `platform_design_system_nav4_panel_default_border` gate.
36
- * This will be `false` while we update app usage, eventually becoming `true`.
37
- * Then this prop will be removed.
35
+ * Defaults to true. Will be removed in the future (and disabling the border will not be supported).
36
+ *
37
+ * @deprecated
38
38
  */
39
39
  hasBorder?: boolean;
40
40
  }): JSX.Element;
@@ -32,9 +32,9 @@ export declare function Panel({ children, defaultWidth: defaultWidthProp, label,
32
32
  /**
33
33
  * Whether or not the slot has its own border. On small screens this becomes a shadow.
34
34
  *
35
- * Defaults to the `platform_design_system_nav4_panel_default_border` gate.
36
- * This will be `false` while we update app usage, eventually becoming `true`.
37
- * Then this prop will be removed.
35
+ * Defaults to true. Will be removed in the future (and disabling the border will not be supported).
36
+ *
37
+ * @deprecated
38
38
  */
39
39
  hasBorder?: boolean;
40
40
  }): JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/navigation-system",
3
- "version": "2.4.1",
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",
@@ -152,9 +152,6 @@
152
152
  "platform_design_system_nav4_sidenav_border": {
153
153
  "type": "boolean"
154
154
  },
155
- "platform_design_system_nav4_panel_default_border": {
156
- "type": "boolean"
157
- },
158
155
  "platform-team25-app-icon-tiles": {
159
156
  "type": "boolean"
160
157
  },
@@ -187,6 +184,9 @@
187
184
  },
188
185
  "platform_dst_nav4_menu_section_heading_a11y": {
189
186
  "type": "boolean"
187
+ },
188
+ "platform_dst_nav4_side_nav_click_outside_fix": {
189
+ "type": "boolean"
190
190
  }
191
191
  },
192
192
  "homepage": "https://atlassian.design/components/navigation-system"