| 91 | * @param {Object} ctx - autoComplete.js context |
| 92 | */ |
| 93 | const close = (ctx) => { |
| 94 | if (!ctx.isOpen) return; |
| 95 | // Set expanded attribute on the parent to false |
| 96 | (ctx.wrapper || ctx.input).setAttribute(Expand, false); |
| 97 | // Add input active descendant attribute |
| 98 | ctx.input.setAttribute(Active, ""); |
| 99 | // Add hidden attribute from list |
| 100 | ctx.list.setAttribute("hidden", ""); |
| 101 | // Set list to closed |
| 102 | ctx.isOpen = false; |
| 103 | |
| 104 | /** |
| 105 | * @emit {close} event after "resultsList" is closed |
| 106 | **/ |
| 107 | eventEmitter("close", ctx); |
| 108 | }; |
| 109 | |
| 110 | /** |
| 111 | * Go to result item by index |