@atlaskit/link-picker 1.25.5 → 1.25.6

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,11 @@
1
1
  # @atlaskit/link-picker
2
2
 
3
+ ## 1.25.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [`21f74cac9b6`](https://bitbucket.org/atlassian/atlassian-frontend/commits/21f74cac9b6) - EDM-6818: Fixes bug where first item of link picker search results appear selected when there is no current selection and a search result is focused. Focus on link picker search results are now on the item that the user clicks/focuses on.
8
+
3
9
  ## 1.25.5
4
10
 
5
11
  ### Patch Changes
@@ -84,12 +84,6 @@ var LinkSearchList = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
84
84
  }
85
85
  return -1;
86
86
  }, [selectedIndex]);
87
- var handleOnFocus = function handleOnFocus() {
88
- if (items && items.length > 0 && selectedIndex === -1) {
89
- var item = items[0];
90
- onChange(item.objectId);
91
- }
92
- };
93
87
  var handleKeyDown = (0, _react.useCallback)(function (event) {
94
88
  var updatedIndex = activeIndex;
95
89
  if (onKeyDown) {
@@ -101,13 +95,12 @@ var LinkSearchList = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
101
95
  updatedIndex = (0, _handleNavKeyDown.handleNavKeyDown)(event, items.length, activeIndex);
102
96
  var item = items === null || items === void 0 ? void 0 : items[updatedIndex];
103
97
  if (['ArrowDown', 'ArrowUp', 'Home', 'End'].includes(event.key) && item) {
104
- onChange(item.objectId);
105
98
  if (itemRefs.current) {
106
99
  var _itemRefs$current$ite;
107
100
  (_itemRefs$current$ite = itemRefs.current[item.objectId]) === null || _itemRefs$current$ite === void 0 ? void 0 : _itemRefs$current$ite.focus();
108
101
  }
109
102
  }
110
- }, [activeIndex, items, onChange, onKeyDown]);
103
+ }, [activeIndex, items, onKeyDown]);
111
104
  if ((items === null || items === void 0 ? void 0 : items.length) === 0) {
112
105
  if ((0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.link-picker.enable-empty-state')) {
113
106
  if (hasSearchTerm) {
@@ -148,7 +141,9 @@ var LinkSearchList = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
148
141
  item: item,
149
142
  selected: selectedIndex === index,
150
143
  active: activeIndex === index,
151
- onFocus: handleOnFocus,
144
+ onFocus: function onFocus() {
145
+ return onChange(item.objectId);
146
+ },
152
147
  onKeyDown: handleKeyDown,
153
148
  onSelect: onSelect,
154
149
  key: item.objectId,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-picker",
3
- "version": "1.25.5",
3
+ "version": "1.25.6",
4
4
  "sideEffects": false
5
5
  }
@@ -74,12 +74,6 @@ export const LinkSearchList = /*#__PURE__*/forwardRef(({
74
74
  }
75
75
  return -1;
76
76
  }, [selectedIndex]);
77
- const handleOnFocus = () => {
78
- if (items && items.length > 0 && selectedIndex === -1) {
79
- const item = items[0];
80
- onChange(item.objectId);
81
- }
82
- };
83
77
  const handleKeyDown = useCallback(event => {
84
78
  let updatedIndex = activeIndex;
85
79
  if (onKeyDown) {
@@ -91,13 +85,12 @@ export const LinkSearchList = /*#__PURE__*/forwardRef(({
91
85
  updatedIndex = handleNavKeyDown(event, items.length, activeIndex);
92
86
  const item = items === null || items === void 0 ? void 0 : items[updatedIndex];
93
87
  if (['ArrowDown', 'ArrowUp', 'Home', 'End'].includes(event.key) && item) {
94
- onChange(item.objectId);
95
88
  if (itemRefs.current) {
96
89
  var _itemRefs$current$ite;
97
90
  (_itemRefs$current$ite = itemRefs.current[item.objectId]) === null || _itemRefs$current$ite === void 0 ? void 0 : _itemRefs$current$ite.focus();
98
91
  }
99
92
  }
100
- }, [activeIndex, items, onChange, onKeyDown]);
93
+ }, [activeIndex, items, onKeyDown]);
101
94
  if ((items === null || items === void 0 ? void 0 : items.length) === 0) {
102
95
  if (getBooleanFF('platform.linking-platform.link-picker.enable-empty-state')) {
103
96
  if (hasSearchTerm) {
@@ -137,7 +130,7 @@ export const LinkSearchList = /*#__PURE__*/forwardRef(({
137
130
  item: item,
138
131
  selected: selectedIndex === index,
139
132
  active: activeIndex === index,
140
- onFocus: handleOnFocus,
133
+ onFocus: () => onChange(item.objectId),
141
134
  onKeyDown: handleKeyDown,
142
135
  onSelect: onSelect,
143
136
  key: item.objectId,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-picker",
3
- "version": "1.25.5",
3
+ "version": "1.25.6",
4
4
  "sideEffects": false
5
5
  }
@@ -76,12 +76,6 @@ export var LinkSearchList = /*#__PURE__*/forwardRef(function (_ref, ref) {
76
76
  }
77
77
  return -1;
78
78
  }, [selectedIndex]);
79
- var handleOnFocus = function handleOnFocus() {
80
- if (items && items.length > 0 && selectedIndex === -1) {
81
- var item = items[0];
82
- onChange(item.objectId);
83
- }
84
- };
85
79
  var handleKeyDown = useCallback(function (event) {
86
80
  var updatedIndex = activeIndex;
87
81
  if (onKeyDown) {
@@ -93,13 +87,12 @@ export var LinkSearchList = /*#__PURE__*/forwardRef(function (_ref, ref) {
93
87
  updatedIndex = handleNavKeyDown(event, items.length, activeIndex);
94
88
  var item = items === null || items === void 0 ? void 0 : items[updatedIndex];
95
89
  if (['ArrowDown', 'ArrowUp', 'Home', 'End'].includes(event.key) && item) {
96
- onChange(item.objectId);
97
90
  if (itemRefs.current) {
98
91
  var _itemRefs$current$ite;
99
92
  (_itemRefs$current$ite = itemRefs.current[item.objectId]) === null || _itemRefs$current$ite === void 0 ? void 0 : _itemRefs$current$ite.focus();
100
93
  }
101
94
  }
102
- }, [activeIndex, items, onChange, onKeyDown]);
95
+ }, [activeIndex, items, onKeyDown]);
103
96
  if ((items === null || items === void 0 ? void 0 : items.length) === 0) {
104
97
  if (getBooleanFF('platform.linking-platform.link-picker.enable-empty-state')) {
105
98
  if (hasSearchTerm) {
@@ -140,7 +133,9 @@ export var LinkSearchList = /*#__PURE__*/forwardRef(function (_ref, ref) {
140
133
  item: item,
141
134
  selected: selectedIndex === index,
142
135
  active: activeIndex === index,
143
- onFocus: handleOnFocus,
136
+ onFocus: function onFocus() {
137
+ return onChange(item.objectId);
138
+ },
144
139
  onKeyDown: handleKeyDown,
145
140
  onSelect: onSelect,
146
141
  key: item.objectId,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-picker",
3
- "version": "1.25.5",
3
+ "version": "1.25.6",
4
4
  "sideEffects": false
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/link-picker",
3
- "version": "1.25.5",
3
+ "version": "1.25.6",
4
4
  "description": "Standalone link picker",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "publishConfig": {
@@ -52,7 +52,7 @@
52
52
  "@atlaskit/form": "^8.11.0",
53
53
  "@atlaskit/frontend-utilities": "^2.7.0",
54
54
  "@atlaskit/icon": "^21.12.0",
55
- "@atlaskit/linking-common": "^3.1.0",
55
+ "@atlaskit/linking-common": "^3.2.0",
56
56
  "@atlaskit/onboarding": "^10.8.2",
57
57
  "@atlaskit/platform-feature-flags": "^0.2.1",
58
58
  "@atlaskit/spinner": "^15.5.0",
@@ -77,19 +77,19 @@
77
77
  },
78
78
  "devDependencies": {
79
79
  "@af/analytics-codegen": "^0.1.0",
80
+ "@af/visual-regression": "*",
80
81
  "@atlaskit/docs": "*",
81
82
  "@atlaskit/dropdown-menu": "^11.10.0",
82
- "@atlaskit/link-analytics": "^8.1.0",
83
+ "@atlaskit/link-analytics": "^8.2.0",
83
84
  "@atlaskit/link-provider": "^1.6.0",
84
85
  "@atlaskit/link-test-helpers": "^4.1.0",
85
- "@atlaskit/linking-common": "^3.1.0",
86
+ "@atlaskit/linking-common": "^3.2.0",
86
87
  "@atlaskit/popup": "^1.8.0",
87
88
  "@atlaskit/toggle": "^12.6.0",
88
89
  "@atlaskit/visual-regression": "*",
89
90
  "@atlaskit/webdriver-runner": "*",
90
91
  "@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
91
92
  "@atlassian/feature-flags-test-utils": "*",
92
- "@atlassian/gemini-visual-regression": "*",
93
93
  "@atlassian/link-picker-atlassian-plugin": "^34.1.0",
94
94
  "@atlassian/link-picker-plugins": "^23.0.0",
95
95
  "@atlassian/recent-work-client": "^1.8.0",