Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
1aae740
Add text and children options to createEl util
DaveOrDead Aug 19, 2016
b742e00
update esdoc for util
DaveOrDead Aug 19, 2016
f226b7c
Add demo file for typeahead
DaveOrDead Aug 19, 2016
8d88499
Add index file for dialog
DaveOrDead Aug 19, 2016
426b7fb
add typeahead functionality for replacing select with text input and …
DaveOrDead Aug 19, 2016
9e33de1
add typeahead to main js file to test
DaveOrDead Aug 19, 2016
9a58b40
add `nodeMap` util
DaveOrDead Aug 19, 2016
1b5f415
update `createEl` to handle event listeners
DaveOrDead Aug 20, 2016
8357d41
`isAlphaNumeric` util
DaveOrDead Aug 20, 2016
5e80f83
fix esdoc on dialog.js
DaveOrDead Aug 20, 2016
0850343
basic placeholder typeahead styles
DaveOrDead Aug 20, 2016
14df126
add keypress events and aria roles
DaveOrDead Aug 20, 2016
f94da27
working with one character
DaveOrDead Aug 20, 2016
4da1c5f
Working for multiple characters and case insensitive
DaveOrDead Aug 20, 2016
2d0e2af
alphabetise results
DaveOrDead Aug 20, 2016
5650672
Add fall back for when nothing matches
DaveOrDead Aug 20, 2016
d755b1b
up and down arrows now step through options list
DaveOrDead Aug 20, 2016
e040cfc
add backspace key
DaveOrDead Aug 20, 2016
62c0d87
update to eslint config that was causing `from` and `else` to throw e…
DaveOrDead Aug 21, 2016
c1ff9c2
remove ununsed state vars and add hidden input
DaveOrDead Aug 21, 2016
a938ac2
clicking option adds value to text input
DaveOrDead Aug 21, 2016
13bb14b
add close functionality
DaveOrDead Aug 21, 2016
c15cc1a
escape and final backspace close dropdown
DaveOrDead Aug 21, 2016
5424d0f
set default class for `is-selected`
DaveOrDead Aug 21, 2016
f340c73
display selected value in text field
DaveOrDead Aug 21, 2016
e0d3d62
remove typeahead
DaveOrDead Aug 24, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@
"semi": [2, "always"],
"semi-spacing": 0,
"sort-vars": 0,
"keyword-spacing": [2, { "before": false, "after": true }],
"keyword-spacing": [2, { "before": true, "after": true }],
"space-before-blocks": [2, "always"],
"space-before-function-paren": [2, {"anonymous": "always", "named": "never"}],
"space-in-brackets": 0,
Expand Down
27 changes: 27 additions & 0 deletions demo/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,30 @@ body {
.dialog.is-active {
display: block !important;
}

.c-typeahead__dropdown {
display: none;
}

.c-typeahead__dropdown.is-active {
display: block !important;
}

.c-typeahead__dropdown {
border: 1px solid;
list-style: none;
margin: 0;
padding: 0;
}

.c-typeahead__dropdown li {
cursor: pointer;
padding: 2px 10px;
}

.c-typeahead__dropdown li:hover,
.c-typeahead__dropdown li.is-selected,
.c-typeahead__dropdown li:focus {
background-color: pink;
outline: none;
}
27 changes: 27 additions & 0 deletions demo/typeahead.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Vanilla UI - Typeahead</title>
<link rel="stylesheet" href="css/main.css">
</head>
<body>

<div class="main-content">
<h1>Vanilla UI—Typeahead</h1>

<div class="js-typeahead">
<label for="typer">No. of players</label>
<select id="typer" name="hadouken">
<option value="" disabled selected>Please Select</option>
<option value="1">One</option>
<option value="2">Two</option>
<option value="3">Three</option>
<option value="4">Four</option>
</select>
</div>

</div>
<script src="../lib/vanilla-ui.js"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion src/components/dialog/dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ const UIDialog = ({
/**
* @function openDialog
* @desc sets up dialog and state ready to be shown
* @param {node} dialog
* @param {Event} e
*/
function openDialog(e) {
// Get trigger button so focus can be returned to it later
Expand Down
3 changes: 3 additions & 0 deletions src/components/dialog/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import dialog from './dialog';

export default dialog;
3 changes: 3 additions & 0 deletions src/components/typeahead/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import typeahead from './typeahead';

export default typeahead;
27 changes: 27 additions & 0 deletions src/components/typeahead/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Vanilla UI - Typeahead / Autocomplete

A widget that…

## Accessibility

The component has been created in accordance with the WAI ARIA guidelines for typeahead dialogs which can be found here in full: <https://www.w3.org/TR/wai-aria-practices-1.1/#autocomplete>.

In summary the following approach has been applied:

***

## TODO

* Add all ARIA.
* Disable vertical scroll on the `<body>`?
* Only 1 to be open at a time?

***

## CSS Fallbacks

***

## Users without Javascript

***
Loading