@github/auto-complete-element
Advanced tools
Comparing version 3.5.0 to 3.5.1
@@ -10,3 +10,5 @@ import Combobox from '@github/combobox-nav'; | ||
this.results = results; | ||
this.combobox = new Combobox(input, results); | ||
this.combobox = new Combobox(input, results, { | ||
defaultFirstOption: autoselectEnabled, | ||
}); | ||
this.feedback = container.getRootNode().getElementById(`${this.results.id}-feedback`); | ||
@@ -71,10 +73,2 @@ this.autoselectEnabled = autoselectEnabled; | ||
onKeydown(event) { | ||
if (event.key === 'Enter' && this.container.open && this.autoselectEnabled) { | ||
const firstOption = this.results.children[0]; | ||
if (firstOption) { | ||
event.stopPropagation(); | ||
event.preventDefault(); | ||
this.onCommit({ target: firstOption }); | ||
} | ||
} | ||
if (event.key === 'Escape' && this.container.open) { | ||
@@ -164,2 +158,3 @@ this.container.open = false; | ||
this.identifyOptions(); | ||
this.combobox.indicateDefaultOption(); | ||
const allNewOptions = this.results.querySelectorAll('[role="option"]'); | ||
@@ -166,0 +161,0 @@ const hasResults = !!allNewOptions.length; |
@@ -217,3 +217,5 @@ var __defProp = Object.defineProperty; | ||
this.results = results; | ||
this.combobox = new Combobox(input, results); | ||
this.combobox = new Combobox(input, results, { | ||
defaultFirstOption: autoselectEnabled | ||
}); | ||
this.feedback = container.getRootNode().getElementById(`${this.results.id}-feedback`); | ||
@@ -278,10 +280,2 @@ this.autoselectEnabled = autoselectEnabled; | ||
onKeydown(event) { | ||
if (event.key === "Enter" && this.container.open && this.autoselectEnabled) { | ||
const firstOption = this.results.children[0]; | ||
if (firstOption) { | ||
event.stopPropagation(); | ||
event.preventDefault(); | ||
this.onCommit({ target: firstOption }); | ||
} | ||
} | ||
if (event.key === "Escape" && this.container.open) { | ||
@@ -367,2 +361,3 @@ this.container.open = false; | ||
this.identifyOptions(); | ||
this.combobox.indicateDefaultOption(); | ||
const allNewOptions = this.results.querySelectorAll('[role="option"]'); | ||
@@ -369,0 +364,0 @@ const hasResults = !!allNewOptions.length; |
{ | ||
"name": "@github/auto-complete-element", | ||
"version": "3.5.0", | ||
"version": "3.5.1", | ||
"description": "Auto-complete input values from server results", | ||
@@ -5,0 +5,0 @@ "repository": "github/auto-complete-element", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
56010
1167