@codemirror/autocomplete 0.20.2 → 0.20.3

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,3 +1,11 @@
1
+ ## 0.20.3 (2022-05-30)
2
+
3
+ ### Bug fixes
4
+
5
+ Add an aria-label to the completion listbox.
6
+
7
+ Fix a regression that caused transactions generated for completion to not have a `userEvent` annotation.
8
+
1
9
  ## 0.20.2 (2022-05-24)
2
10
 
3
11
  ### New features
package/dist/index.cjs CHANGED
@@ -159,7 +159,7 @@ completion's text in the main selection range, and any other
159
159
  selection range that has the same text in front of it.
160
160
  */
161
161
  function insertCompletionText(state$1, text, from, to) {
162
- return state$1.changeByRange(range => {
162
+ return Object.assign(Object.assign({}, state$1.changeByRange(range => {
163
163
  if (range == state$1.selection.main)
164
164
  return {
165
165
  changes: { from: from, to: to, insert: text },
@@ -173,7 +173,7 @@ function insertCompletionText(state$1, text, from, to) {
173
173
  changes: { from: range.from - len, to: range.from, insert: text },
174
174
  range: state.EditorSelection.cursor(range.from - len + text.length)
175
175
  };
176
- });
176
+ })), { userEvent: "input.complete" });
177
177
  }
178
178
  function applyCompletion(view, option) {
179
179
  const apply = option.completion.apply || option.completion.label;
@@ -532,6 +532,7 @@ class CompletionTooltip {
532
532
  ul.id = id;
533
533
  ul.setAttribute("role", "listbox");
534
534
  ul.setAttribute("aria-expanded", "true");
535
+ ul.setAttribute("aria-label", this.view.state.phrase("Completions"));
535
536
  for (let i = range.from; i < range.to; i++) {
536
537
  let { completion, match } = options[i];
537
538
  const li = ul.appendChild(document.createElement("li"));
package/dist/index.js CHANGED
@@ -155,7 +155,7 @@ completion's text in the main selection range, and any other
155
155
  selection range that has the same text in front of it.
156
156
  */
157
157
  function insertCompletionText(state, text, from, to) {
158
- return state.changeByRange(range => {
158
+ return Object.assign(Object.assign({}, state.changeByRange(range => {
159
159
  if (range == state.selection.main)
160
160
  return {
161
161
  changes: { from: from, to: to, insert: text },
@@ -169,7 +169,7 @@ function insertCompletionText(state, text, from, to) {
169
169
  changes: { from: range.from - len, to: range.from, insert: text },
170
170
  range: EditorSelection.cursor(range.from - len + text.length)
171
171
  };
172
- });
172
+ })), { userEvent: "input.complete" });
173
173
  }
174
174
  function applyCompletion(view, option) {
175
175
  const apply = option.completion.apply || option.completion.label;
@@ -528,6 +528,7 @@ class CompletionTooltip {
528
528
  ul.id = id;
529
529
  ul.setAttribute("role", "listbox");
530
530
  ul.setAttribute("aria-expanded", "true");
531
+ ul.setAttribute("aria-label", this.view.state.phrase("Completions"));
531
532
  for (let i = range.from; i < range.to; i++) {
532
533
  let { completion, match } = options[i];
533
534
  const li = ul.appendChild(document.createElement("li"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemirror/autocomplete",
3
- "version": "0.20.2",
3
+ "version": "0.20.3",
4
4
  "description": "Autocompletion for the CodeMirror code editor",
5
5
  "scripts": {
6
6
  "test": "cm-runtests",