@atlaskit/editor-plugin-find-replace 0.2.0 → 0.3.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,11 @@
1
1
  # @atlaskit/editor-plugin-find-replace
2
2
 
3
+ ## 0.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#67595](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/67595) [`3bb66071a333`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3bb66071a333) - [ux] ECA11Y-75: Updated UX/UI for "Find and Replace" modal window, added Focus trap to Find and Replace popup, added return focus to the search button when pressing ESC, update selected match and all matches highlighted colors, added Screan Reader announcements for repeated button clicks ( subtickets: ECA11Y-144, ECA11Y-145, ECA11Y-146, ECA11Y-147, ECA11Y-148, ECA11Y-149 )
8
+
3
9
  ## 0.2.0
4
10
 
5
11
  ### Minor Changes
@@ -5,13 +5,26 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.selectedSearchMatchClass = exports.searchMatchClass = exports.findReplaceStyles = void 0;
8
- var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
8
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
9
  var _react = require("@emotion/react");
10
10
  var _colors = require("@atlaskit/theme/colors");
11
- var _templateObject;
11
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
12
+ var _css;
12
13
  /* eslint-disable @atlaskit/design-system/ensure-design-token-usage/preview */
13
14
  /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
15
+ /* eslint-disable */
14
16
  // TODO: https://product-fabric.atlassian.net/browse/DSP-4290
15
17
  var searchMatchClass = exports.searchMatchClass = 'search-match';
16
18
  var selectedSearchMatchClass = exports.selectedSearchMatchClass = 'selected-search-match';
17
- var findReplaceStyles = exports.findReplaceStyles = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .", " {\n background-color: ", ";\n }\n\n .", " {\n background-color: ", ";\n color: white;\n }\n"])), searchMatchClass, _colors.B75, selectedSearchMatchClass, _colors.B200);
19
+ var findReplaceStyles = exports.findReplaceStyles = (0, _react.css)((_css = {}, (0, _defineProperty2.default)(_css, ".".concat(searchMatchClass), (0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-find-replace') ? {
20
+ borderRadius: '3px',
21
+ backgroundColor: "var(--ds-background-accent-teal-subtlest, #E7F9FF)",
22
+ boxShadow: "var(--ds-shadow-raised, ".concat("0 1px 1px 0 ".concat(_colors.N50A, ", 0 0 1px 0 ").concat(_colors.N60A), ")") + ', inset 0 0 0 1px ' + "var(--ds-border-input, ".concat("".concat(_colors.N40A), ")")
23
+ } : {
24
+ backgroundColor: _colors.B75
25
+ }), (0, _defineProperty2.default)(_css, ".".concat(selectedSearchMatchClass), (0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-find-replace') ? {
26
+ backgroundColor: "var(--ds-background-accent-teal-subtle, #6CC3E0)"
27
+ } : {
28
+ backgroundColor: _colors.B200,
29
+ color: 'white'
30
+ }), _css));
@@ -18,6 +18,7 @@ var _debounce = _interopRequireDefault(require("lodash/debounce"));
18
18
  var _rafSchd = _interopRequireDefault(require("raf-schd"));
19
19
  var _reactIntlNext = require("react-intl-next");
20
20
  var _analytics = require("@atlaskit/editor-common/analytics");
21
+ var _form = require("@atlaskit/form");
21
22
  var _close = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/close"));
22
23
  var _keyboard = _interopRequireDefault(require("@atlaskit/icon/glyph/emoji/keyboard"));
23
24
  var _chevronDown = _interopRequireDefault(require("@atlaskit/icon/glyph/hipchat/chevron-down"));
@@ -110,6 +111,7 @@ var Find = /*#__PURE__*/function (_React$Component) {
110
111
  onSynced && onSynced();
111
112
  _this.debouncedFind(value);
112
113
  });
114
+ _this.props.setFindTyped(true);
113
115
  });
114
116
  // throtlle between animation frames gives better experience on Enter compared to arbitrary value
115
117
  // it adjusts based on performance (and document size)
@@ -182,7 +184,8 @@ var Find = /*#__PURE__*/function (_React$Component) {
182
184
  _this.findPrevious = formatMessage(messages.findPrevious);
183
185
  _this.matchCase = formatMessage(messages.matchCase);
184
186
  _this.matchCaseIcon = (0, _react2.jsx)(_keyboard.default, {
185
- label: _this.matchCase
187
+ label: _this.matchCase,
188
+ size: (0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-find-replace') ? 'small' : 'medium'
186
189
  });
187
190
  _this.findNextIcon = (0, _react2.jsx)(_chevronDown.default, {
188
191
  label: _this.findNext
@@ -222,21 +225,19 @@ var Find = /*#__PURE__*/function (_React$Component) {
222
225
  }, {
223
226
  key: "componentDidUpdate",
224
227
  value: function componentDidUpdate(prevProps) {
225
- var _this3 = this;
228
+ var _this$state2,
229
+ _this3 = this;
226
230
  // focus on update if find text did not change
227
- if (!(0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-find-replace')) {
228
- var _this$state2;
229
- if (this.props.findText === ((_this$state2 = this.state) === null || _this$state2 === void 0 ? void 0 : _this$state2.localFindText)) {
230
- this.focusFindTextfield();
231
- }
232
- if (this.props.findText !== prevProps.findText) {
233
- this.syncFindText(function () {
234
- // focus after input is synced if find text provided
235
- if (_this3.props.findText) {
236
- _this3.focusFindTextfield();
237
- }
238
- });
239
- }
231
+ if (this.props.findText === ((_this$state2 = this.state) === null || _this$state2 === void 0 ? void 0 : _this$state2.localFindText)) {
232
+ this.focusFindTextfield();
233
+ }
234
+ if (this.props.findText !== prevProps.findText) {
235
+ this.syncFindText(function () {
236
+ // focus after input is synced if find text provided
237
+ if (_this3.props.findText) {
238
+ _this3.focusFindTextfield();
239
+ }
240
+ });
240
241
  }
241
242
  }
242
243
  }, {
@@ -258,50 +259,90 @@ var Find = /*#__PURE__*/function (_React$Component) {
258
259
  selectedMatchPosition: count.index + 1,
259
260
  totalResultsCount: count.total
260
261
  });
261
- return (0, _react2.jsx)("div", {
262
- css: _styles.sectionWrapperStyles
263
- }, (0, _react2.jsx)(_textfield.default, {
264
- name: "find",
265
- appearance: "none",
266
- placeholder: this.find,
267
- value: this.state.localFindText,
268
- ref: this.findTextfieldRef,
269
- autoComplete: "off",
270
- onChange: this.handleFindChange,
271
- onKeyDown: this.handleFindKeyDown,
272
- onKeyUp: this.handleFindKeyUp,
273
- onBlur: this.props.onFindBlur,
274
- onCompositionStart: this.handleCompositionStart,
275
- onCompositionEnd: this.handleCompositionEnd
276
- }), (0, _react2.jsx)("div", {
277
- css: _styles.countWrapperStyles,
278
- "aria-live": "polite"
279
- }, findText && (0, _react2.jsx)("span", {
280
- "data-testid": "textfield-count",
281
- css: _styles.countStyles
282
- }, count.total === 0 ? this.noResultsFound : resultsCount)), allowMatchCase && (0, _react2.jsx)(_FindReplaceTooltipButton.FindReplaceTooltipButton, {
283
- title: this.matchCase,
284
- icon: this.matchCaseIcon,
285
- onClick: this.handleMatchCaseClick,
286
- isPressed: shouldMatchCase
287
- }), (0, _react2.jsx)(_FindReplaceTooltipButton.FindReplaceTooltipButton, {
288
- title: this.findNext,
289
- icon: this.findNextIcon,
290
- keymapDescription: 'Enter',
291
- onClick: this.handleFindNextClick,
292
- disabled: count.total <= 1
293
- }), (0, _react2.jsx)(_FindReplaceTooltipButton.FindReplaceTooltipButton, {
294
- title: this.findPrevious,
295
- icon: this.findPrevIcon,
296
- keymapDescription: 'Shift Enter',
297
- onClick: this.handleFindPrevClick,
298
- disabled: count.total <= 1
299
- }), (0, _react2.jsx)(_FindReplaceTooltipButton.FindReplaceTooltipButton, {
300
- title: this.closeFindReplaceDialog,
301
- icon: this.closeIcon,
302
- keymapDescription: 'Escape',
303
- onClick: this.clearSearch
304
- }));
262
+ if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-find-replace')) {
263
+ var elemAfterInput = (0, _react2.jsx)("div", {
264
+ css: _styles.afterInputSection
265
+ }, (0, _react2.jsx)("div", {
266
+ "aria-live": "polite"
267
+ }, findText && (0, _react2.jsx)("span", {
268
+ "data-testid": "textfield-count",
269
+ css: [_styles.countStyles, _styles.countStylesAlternateStyles]
270
+ }, count.total === 0 ? this.noResultsFound : resultsCount)), allowMatchCase && (0, _react2.jsx)("div", {
271
+ css: _styles.matchCaseSection
272
+ }, (0, _react2.jsx)(_FindReplaceTooltipButton.FindReplaceTooltipButton, {
273
+ title: this.matchCase,
274
+ appearance: "default",
275
+ icon: this.matchCaseIcon,
276
+ onClick: this.handleMatchCaseClick,
277
+ isPressed: shouldMatchCase
278
+ })));
279
+ return (0, _react2.jsx)("div", {
280
+ css: [_styles.sectionWrapperStyles, _styles.sectionWrapperStylesAlternate]
281
+ }, (0, _react2.jsx)("div", {
282
+ css: _styles.textFieldWrapper
283
+ }, (0, _react2.jsx)(_form.Label, {
284
+ htmlFor: "find-text-field"
285
+ }, this.find), (0, _react2.jsx)(_textfield.default, {
286
+ name: "find",
287
+ id: "find-text-field",
288
+ appearance: "standard",
289
+ value: this.state.localFindText,
290
+ ref: this.findTextfieldRef,
291
+ autoComplete: "off",
292
+ onChange: this.handleFindChange,
293
+ onKeyDown: this.handleFindKeyDown,
294
+ onKeyUp: this.handleFindKeyUp,
295
+ onBlur: this.props.onFindBlur,
296
+ onCompositionStart: this.handleCompositionStart,
297
+ onCompositionEnd: this.handleCompositionEnd,
298
+ elemAfterInput: elemAfterInput
299
+ })));
300
+ } else {
301
+ return (0, _react2.jsx)("div", {
302
+ css: _styles.sectionWrapperStyles
303
+ }, (0, _react2.jsx)(_textfield.default, {
304
+ name: "find",
305
+ appearance: "none",
306
+ placeholder: this.find,
307
+ value: this.state.localFindText,
308
+ ref: this.findTextfieldRef,
309
+ autoComplete: "off",
310
+ onChange: this.handleFindChange,
311
+ onKeyDown: this.handleFindKeyDown,
312
+ onKeyUp: this.handleFindKeyUp,
313
+ onBlur: this.props.onFindBlur,
314
+ onCompositionStart: this.handleCompositionStart,
315
+ onCompositionEnd: this.handleCompositionEnd
316
+ }), (0, _react2.jsx)("div", {
317
+ css: _styles.countWrapperStyles,
318
+ "aria-live": "polite"
319
+ }, findText && (0, _react2.jsx)("span", {
320
+ "data-testid": "textfield-count",
321
+ css: _styles.countStyles
322
+ }, count.total === 0 ? this.noResultsFound : resultsCount)), allowMatchCase && (0, _react2.jsx)(_FindReplaceTooltipButton.FindReplaceTooltipButton, {
323
+ title: this.matchCase,
324
+ icon: this.matchCaseIcon,
325
+ onClick: this.handleMatchCaseClick,
326
+ isPressed: shouldMatchCase
327
+ }), (0, _react2.jsx)(_FindReplaceTooltipButton.FindReplaceTooltipButton, {
328
+ title: this.findNext,
329
+ icon: this.findNextIcon,
330
+ keymapDescription: 'Enter',
331
+ onClick: this.handleFindNextClick,
332
+ disabled: count.total <= 1
333
+ }), (0, _react2.jsx)(_FindReplaceTooltipButton.FindReplaceTooltipButton, {
334
+ title: this.findPrevious,
335
+ icon: this.findPrevIcon,
336
+ keymapDescription: 'Shift Enter',
337
+ onClick: this.handleFindPrevClick,
338
+ disabled: count.total <= 1
339
+ }), (0, _react2.jsx)(_FindReplaceTooltipButton.FindReplaceTooltipButton, {
340
+ title: this.closeFindReplaceDialog,
341
+ icon: this.closeIcon,
342
+ keymapDescription: 'Escape',
343
+ onClick: this.clearSearch
344
+ }));
345
+ }
305
346
  }
306
347
  }]);
307
348
  return Find;
@@ -14,6 +14,7 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
14
14
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
15
  var _react = _interopRequireDefault(require("react"));
16
16
  var _react2 = require("@emotion/react");
17
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
17
18
  var _Find = _interopRequireDefault(require("./Find"));
18
19
  var _Replace = _interopRequireDefault(require("./Replace"));
19
20
  var _styles = require("./styles");
@@ -23,15 +24,45 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
23
24
  var FindReplace = /*#__PURE__*/function (_React$PureComponent) {
24
25
  (0, _inherits2.default)(FindReplace, _React$PureComponent);
25
26
  var _super = _createSuper(FindReplace);
26
- function FindReplace() {
27
+ function FindReplace(props) {
27
28
  var _this;
28
29
  (0, _classCallCheck2.default)(this, FindReplace);
29
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
30
- args[_key] = arguments[_key];
31
- }
32
- _this = _super.call.apply(_super, [this].concat(args));
30
+ _this = _super.call(this, props);
33
31
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "findTextfield", null);
34
32
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "replaceTextfield", null);
33
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleTabNavigation", function (event) {
34
+ if (event.key === 'Tab') {
35
+ event.preventDefault();
36
+ var modalFindReplace = _this.modalRef.current;
37
+ if (!modalFindReplace || !modalFindReplace.contains(document.activeElement)) {
38
+ return;
39
+ }
40
+ var focusableElements = Array.from(modalFindReplace.querySelectorAll('[tabindex]:not([tabindex="-1"]), input, button')).filter(function (el) {
41
+ return el.getAttribute('tabindex') !== '-1';
42
+ });
43
+ var currentIndex = focusableElements.findIndex(function (el) {
44
+ return el === document.activeElement;
45
+ });
46
+ var isShiftPressed = event.shiftKey;
47
+ if (isShiftPressed) {
48
+ var prevIndex = (currentIndex - 1 + focusableElements.length) % focusableElements.length;
49
+ focusableElements[prevIndex].focus();
50
+ } else {
51
+ var nextIndex = (currentIndex + 1) % focusableElements.length;
52
+ focusableElements[nextIndex].focus();
53
+ }
54
+ }
55
+ });
56
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "state", {
57
+ findTyped: false
58
+ });
59
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "setFindTyped", function (value) {
60
+ if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-find-replace')) {
61
+ _this.setState({
62
+ findTyped: value
63
+ });
64
+ }
65
+ });
35
66
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "setFindTextfieldRef", function (findTextfieldRef) {
36
67
  _this.findTextfield = findTextfieldRef.current;
37
68
  });
@@ -48,9 +79,26 @@ var FindReplace = /*#__PURE__*/function (_React$PureComponent) {
48
79
  _this.replaceTextfield.focus();
49
80
  }
50
81
  });
82
+ _this.modalRef = /*#__PURE__*/_react.default.createRef();
51
83
  return _this;
52
84
  }
53
85
  (0, _createClass2.default)(FindReplace, [{
86
+ key: "componentDidMount",
87
+ value: function componentDidMount() {
88
+ if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-find-replace')) {
89
+ // eslint-disable-next-line
90
+ window.addEventListener('keydown', this.handleTabNavigation);
91
+ }
92
+ }
93
+ }, {
94
+ key: "componentWillUnmount",
95
+ value: function componentWillUnmount() {
96
+ if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-find-replace')) {
97
+ // eslint-disable-next-line
98
+ window.removeEventListener('keydown', this.handleTabNavigation);
99
+ }
100
+ }
101
+ }, {
54
102
  key: "render",
55
103
  value: function render() {
56
104
  var _this$props = this.props,
@@ -69,8 +117,10 @@ var FindReplace = /*#__PURE__*/function (_React$PureComponent) {
69
117
  allowMatchCase = _this$props.allowMatchCase,
70
118
  shouldMatchCase = _this$props.shouldMatchCase,
71
119
  onToggleMatchCase = _this$props.onToggleMatchCase;
120
+ var focusToolbarButton = (0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-find-replace') ? this.props.focusToolbarButton || function () {} : function () {};
72
121
  return (0, _react2.jsx)("div", {
73
- css: _styles.wrapperStyles
122
+ ref: this.modalRef,
123
+ css: (0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-find-replace') ? [_styles.wrapperStyles, _styles.wrapperPaddingStyles] : _styles.wrapperStyles
74
124
  }, (0, _react2.jsx)(_Find.default, {
75
125
  allowMatchCase: allowMatchCase,
76
126
  shouldMatchCase: shouldMatchCase,
@@ -84,8 +134,10 @@ var FindReplace = /*#__PURE__*/function (_React$PureComponent) {
84
134
  onFindNext: onFindNext,
85
135
  onFindTextfieldRefSet: this.setFindTextfieldRef,
86
136
  onCancel: onCancel,
87
- onArrowDown: this.setFocusToReplace
88
- }), (0, _react2.jsx)("hr", {
137
+ onArrowDown: this.setFocusToReplace,
138
+ findTyped: this.state.findTyped,
139
+ setFindTyped: this.setFindTyped
140
+ }), !(0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-find-replace') && (0, _react2.jsx)("hr", {
89
141
  css: _styles.ruleStyles,
90
142
  id: "replace-hr-element"
91
143
  }), (0, _react2.jsx)(_Replace.default, {
@@ -95,7 +147,14 @@ var FindReplace = /*#__PURE__*/function (_React$PureComponent) {
95
147
  onReplaceAll: onReplaceAll,
96
148
  onReplaceTextfieldRefSet: this.setReplaceTextfieldRef,
97
149
  onArrowUp: this.setFocusToFind,
98
- dispatchAnalyticsEvent: dispatchAnalyticsEvent
150
+ onCancel: onCancel,
151
+ count: count,
152
+ onFindPrev: onFindPrev,
153
+ onFindNext: onFindNext,
154
+ dispatchAnalyticsEvent: dispatchAnalyticsEvent,
155
+ findTyped: this.state.findTyped,
156
+ setFindTyped: this.setFindTyped,
157
+ focusToolbarButton: focusToolbarButton
99
158
  }));
100
159
  }
101
160
  }]);
@@ -22,6 +22,7 @@ var _keymaps = require("@atlaskit/editor-common/keymaps");
22
22
  var _uiMenu = require("@atlaskit/editor-common/ui-menu");
23
23
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
24
24
  var _search = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/search"));
25
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
25
26
  var _FindReplace = _interopRequireDefault(require("./FindReplace"));
26
27
  var _templateObject, _templateObject2, _templateObject3;
27
28
  /* eslint-disable @atlaskit/design-system/consistent-css-prop-usage */
@@ -38,6 +39,8 @@ var messages = (0, _reactIntlNext.defineMessages)({
38
39
  description: '"Find" highlights all instances of a word or phrase on the document, and "Replace" changes one or all of those instances to something else'
39
40
  }
40
41
  });
42
+ var dropdownWidthNewDesign = 382;
43
+ var dropdownWidthOldDesign = 352;
41
44
  // eslint-disable-next-line @repo/internal/react/no-class-components
42
45
  var FindReplaceToolbarButton = /*#__PURE__*/function (_React$PureComponent) {
43
46
  (0, _inherits2.default)(FindReplaceToolbarButton, _React$PureComponent);
@@ -49,15 +52,30 @@ var FindReplaceToolbarButton = /*#__PURE__*/function (_React$PureComponent) {
49
52
  args[_key] = arguments[_key];
50
53
  }
51
54
  _this = _super.call.apply(_super, [this].concat(args));
55
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "state", {
56
+ openedByClick: false
57
+ });
52
58
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "toggleOpen", function () {
53
59
  if (_this.props.isActive) {
54
60
  _this.props.onCancel({
55
61
  triggerMethod: _analytics.TRIGGER_METHOD.TOOLBAR
56
62
  });
57
63
  } else {
64
+ _this.setState({
65
+ openedByClick: true
66
+ });
58
67
  _this.props.onActivate();
59
68
  }
60
69
  });
70
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "focusToolbarButton", function () {
71
+ if (_this.state.openedByClick && _this.toolbarButtonRef.current) {
72
+ _this.toolbarButtonRef.current.focus();
73
+ }
74
+ _this.setState({
75
+ openedByClick: false
76
+ });
77
+ });
78
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "toolbarButtonRef", /*#__PURE__*/_react.default.createRef());
61
79
  return _this;
62
80
  }
63
81
  (0, _createClass2.default)(FindReplaceToolbarButton, [{
@@ -91,9 +109,17 @@ var FindReplaceToolbarButton = /*#__PURE__*/function (_React$PureComponent) {
91
109
  _this2.props.onCancel({
92
110
  triggerMethod: _analytics.TRIGGER_METHOD.KEYBOARD
93
111
  });
112
+ if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-find-replace')) {
113
+ if (_this2.state.openedByClick && _this2.toolbarButtonRef.current) {
114
+ _this2.toolbarButtonRef.current.focus();
115
+ }
116
+ _this2.setState({
117
+ openedByClick: false
118
+ });
119
+ }
94
120
  }
95
121
  },
96
- fitWidth: 352,
122
+ fitWidth: (0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-find-replace') ? dropdownWidthNewDesign : dropdownWidthOldDesign,
97
123
  zIndex: stackBelowOtherEditorFloatingPanels,
98
124
  arrowKeyNavigationProviderOptions: {
99
125
  type: _uiMenu.ArrowKeyNavigationType.MENU,
@@ -114,7 +140,8 @@ var FindReplaceToolbarButton = /*#__PURE__*/function (_React$PureComponent) {
114
140
  "aria-expanded": isActive,
115
141
  "aria-haspopup": true,
116
142
  "aria-label": keymap ? (0, _keymaps.tooltip)(keymap, title) : title,
117
- "aria-keyshortcuts": (0, _keymaps.getAriaKeyshortcuts)(keymap)
143
+ "aria-keyshortcuts": (0, _keymaps.getAriaKeyshortcuts)(keymap),
144
+ ref: (0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-find-replace') ? this.toolbarButtonRef : null
118
145
  })
119
146
  }, (0, _react2.jsx)("div", {
120
147
  css: wrapper
@@ -124,7 +151,8 @@ var FindReplaceToolbarButton = /*#__PURE__*/function (_React$PureComponent) {
124
151
  count: {
125
152
  index: index,
126
153
  total: numMatches
127
- }
154
+ },
155
+ focusToolbarButton: this.focusToolbarButton
128
156
  }, this.props)))));
129
157
  }
130
158
  }]);
@@ -46,7 +46,8 @@ var FindReplaceTooltipButton = exports.FindReplaceTooltipButton = /*#__PURE__*/f
46
46
  icon = _this$props.icon,
47
47
  keymapDescription = _this$props.keymapDescription,
48
48
  disabled = _this$props.disabled,
49
- isPressed = _this$props.isPressed;
49
+ isPressed = _this$props.isPressed,
50
+ appearance = _this$props.appearance;
50
51
  var pressedProps = _objectSpread({}, typeof isPressed === 'boolean' && {
51
52
  'aria-pressed': isPressed
52
53
  });
@@ -58,8 +59,9 @@ var FindReplaceTooltipButton = exports.FindReplaceTooltipButton = /*#__PURE__*/f
58
59
  hideTooltipOnClick: true,
59
60
  position: 'top'
60
61
  }, /*#__PURE__*/_react.default.createElement(_standardButton.default, (0, _extends2.default)({
62
+ id: "afterInputSection",
61
63
  label: title,
62
- appearance: "subtle",
64
+ appearance: appearance,
63
65
  testId: title,
64
66
  ref: this.buttonRef,
65
67
  iconBefore: icon,
@@ -73,5 +75,6 @@ var FindReplaceTooltipButton = exports.FindReplaceTooltipButton = /*#__PURE__*/f
73
75
  return FindReplaceTooltipButton;
74
76
  }(_react.default.PureComponent);
75
77
  (0, _defineProperty2.default)(FindReplaceTooltipButton, "defaultProps", {
76
- keymapDescription: 'no-keymap'
78
+ keymapDescription: 'no-keymap',
79
+ appearance: 'subtle'
77
80
  });