radar-sdk-js
Advanced tools
Comparing version 4.3.1-beta.2 to 4.3.2-beta.0
@@ -1,2 +0,2 @@ | ||
declare const _default: "4.3.1-beta.2"; | ||
declare const _default: "4.3.2-beta.0"; | ||
export default _default; |
{ | ||
"name": "radar-sdk-js", | ||
"version": "4.3.1-beta.2", | ||
"version": "4.3.2-beta.0", | ||
"description": "Web Javascript SDK for Radar, location infrastructure for mobile and web apps.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://radar.com", |
@@ -59,3 +59,3 @@ <p align="center"> | ||
```html | ||
<script src="https://js.radar.com/v4.3.1-beta.2/radar.min.js"></script> | ||
<script src="https://js.radar.com/v4.3.2-beta.0/radar.min.js"></script> | ||
``` | ||
@@ -77,4 +77,4 @@ | ||
<head> | ||
<link href="https://js.radar.com/v4.3.1-beta.2/radar.css" rel="stylesheet"> | ||
<script src="https://js.radar.com/v4.3.1-beta.2/radar.min.js"></script> | ||
<link href="https://js.radar.com/v4.3.2-beta.0/radar.css" rel="stylesheet"> | ||
<script src="https://js.radar.com/v4.3.2-beta.0/radar.min.js"></script> | ||
</head> | ||
@@ -103,4 +103,4 @@ | ||
<head> | ||
<link href="https://js.radar.com/v4.3.1-beta.2/radar.css" rel="stylesheet"> | ||
<script src="https://js.radar.com/v4.3.1-beta.2/radar.min.js"></script> | ||
<link href="https://js.radar.com/v4.3.2-beta.0/radar.css" rel="stylesheet"> | ||
<script src="https://js.radar.com/v4.3.2-beta.0/radar.min.js"></script> | ||
</head> | ||
@@ -136,4 +136,4 @@ | ||
<head> | ||
<link href="https://js.radar.com/v4.3.1-beta.2/radar.css" rel="stylesheet"> | ||
<script src="https://js.radar.com/v4.3.1-beta.2/radar.min.js"></script> | ||
<link href="https://js.radar.com/v4.3.2-beta.0/radar.css" rel="stylesheet"> | ||
<script src="https://js.radar.com/v4.3.2-beta.0/radar.min.js"></script> | ||
</head> | ||
@@ -140,0 +140,0 @@ |
@@ -19,2 +19,6 @@ import Logger from '../logger'; | ||
const ARIA = { | ||
EXPANDED: 'aria-expanded', | ||
}; | ||
const defaultAutocompleteOptions: RadarAutocompleteUIOptions = { | ||
@@ -136,6 +140,2 @@ container: 'autocomplete', | ||
this.resultsList.classList.add(CLASSNAMES.RESULTS_LIST); | ||
this.resultsList.classList.add('id', CLASSNAMES.RESULTS_LIST); | ||
this.resultsList.setAttribute('role', 'listbox'); | ||
this.resultsList.setAttribute('aria-live', 'polite'); | ||
this.resultsList.setAttribute('aria-label', 'Search results'); | ||
setHeight(this.resultsList, this.config); | ||
@@ -173,10 +173,2 @@ | ||
// set aria roles | ||
this.inputField.setAttribute('role', 'combobox'); | ||
this.inputField.setAttribute('aria-controls', CLASSNAMES.RESULTS_LIST); | ||
this.inputField.setAttribute('aria-expanded', 'false'); | ||
this.inputField.setAttribute('aria-haspopup', 'listbox'); | ||
this.inputField.setAttribute('aria-autocomplete', 'list'); | ||
this.inputField.setAttribute('aria-activedescendant', ''); | ||
// setup event listeners | ||
@@ -289,4 +281,2 @@ this.inputField.addEventListener('input', this.handleInput.bind(this)); | ||
li.classList.add(CLASSNAMES.RESULTS_ITEM); | ||
li.setAttribute('role', 'option'); | ||
li.setAttribute('id', `item-${index}`); | ||
@@ -353,3 +343,3 @@ // construct result with bolded label | ||
this.inputField.setAttribute('aria-expanded', 'true'); | ||
this.wrapper.setAttribute(ARIA.EXPANDED, 'true'); | ||
this.resultsList.removeAttribute('hidden'); | ||
@@ -368,4 +358,3 @@ this.isOpen = true; | ||
setTimeout(() => { | ||
this.inputField.setAttribute('aria-expanded', 'false'); | ||
this.inputField.setAttribute('aria-activedescendant', ''); | ||
this.wrapper.removeAttribute(ARIA.EXPANDED); | ||
this.resultsList.setAttribute('hidden', ''); | ||
@@ -400,5 +389,2 @@ this.highlightedIndex = -1; | ||
// set aria active descendant | ||
this.inputField.setAttribute('aria-activedescendant', `item-${index}`); | ||
this.highlightedIndex = index; | ||
@@ -408,3 +394,4 @@ } | ||
public handleKeyboardNavigation(event: KeyboardEvent) { | ||
const key = event.key; | ||
// fallback to deprecated "keyCode" if event.code not set | ||
const code = event.code !== undefined ? event.code : event.keyCode; | ||
@@ -416,6 +403,7 @@ // allow event to propagate if result list is not open | ||
switch (key) { | ||
switch (code) { | ||
// Next item | ||
case 'Tab': | ||
case 'ArrowDown': | ||
case 40: | ||
event.preventDefault(); | ||
@@ -427,2 +415,3 @@ this.goTo(this.highlightedIndex + 1); | ||
case 'ArrowUp': | ||
case 38: | ||
event.preventDefault(); | ||
@@ -434,2 +423,3 @@ this.goTo(this.highlightedIndex - 1); | ||
case 'Enter': | ||
case 13: | ||
this.select(this.highlightedIndex); | ||
@@ -440,2 +430,3 @@ break; | ||
case 'Esc': | ||
case 27: | ||
this.close(); | ||
@@ -442,0 +433,0 @@ break; |
@@ -1,1 +0,1 @@ | ||
export default '4.3.1-beta.2'; | ||
export default '4.3.2-beta.0'; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
304347
64
6224