-
Notifications
You must be signed in to change notification settings - Fork 355
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ARIA 1.1 Combobox Pattern: First Draft with Two Examples (pull #463)
* For issue #31, first draft of the combobox design pattern. * For issue #100, first cut of code for ARIA 1.1 style combobox examples with listbox and grid popups. The example pages do not yet include any documentation; example code only.
- Loading branch information
Showing
10 changed files
with
1,343 additions
and
65 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+220 Bytes
examples/combobox/aria1.1pattern/imgs/arrow_drop_down_grey_27x27.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
/** | ||
* ARIA Combobox Examples | ||
*/ | ||
|
||
var FRUITS_AND_VEGGIES = [ | ||
['Apple', 'Fruit'], | ||
['Artichoke', 'Vegetable'], | ||
['Asparagus', 'Vegetable'], | ||
['Banana', 'Fruit'], | ||
['Beets', 'Vegetable'], | ||
['Bell pepper', 'Vegetable'], | ||
['Broccoli', 'Vegetable'], | ||
['Brussels sprout', 'Vegetable'], | ||
['Cabbage', 'Vegetable'], | ||
['Carrot', 'Vegetable'], | ||
['Cauliflower', 'Vegetable'], | ||
['Celery', 'Vegetable'], | ||
['Chard', 'Vegetable'], | ||
['Chicory', 'Vegetable'], | ||
['Corn', 'Vegetable'], | ||
['Cucumber', 'Vegetable'], | ||
['Daikon', 'Vegetable'], | ||
['Date', 'Fruit'], | ||
['Edamame', 'Vegetable'], | ||
['Eggplant', 'Vegetable'], | ||
['Elderberry', 'Fruit'], | ||
['Fennel', 'Vegetable'], | ||
['Fig', 'Fruit'], | ||
['Garlic', 'Vegetable'], | ||
['Grape', 'Fruit'], | ||
['Honeydew melon', 'Fruit'], | ||
['Iceberg lettuce', 'Vegetable'], | ||
['Jerusalem artichoke', 'Vegetable'], | ||
['Kale', 'Vegetable'], | ||
['Kiwi', 'Fruit'], | ||
['Leek', 'Vegetable'], | ||
['Lemon', 'Fruit'], | ||
['Mango', 'Fruit'], | ||
['Mangosteen', 'Fruit'], | ||
['Melon', 'Fruit'], | ||
['Mushroom', 'Fungus'], | ||
['Nectarine', 'Fruit'], | ||
['Okra', 'Vegetable'], | ||
['Olive', 'Vegetable'], | ||
['Onion', 'Vegetable'], | ||
['Orange', 'Fruit'], | ||
['Parship', 'Vegetable'], | ||
['Pea', 'Vegetable'], | ||
['Pear', 'Fruit'], | ||
['Pineapple', 'Fruit'], | ||
['Potato', 'Vegetable'], | ||
['Pumpkin', 'Fruit'], | ||
['Quince', 'Fruit'], | ||
['Radish', 'Vegetable'], | ||
['Rhubarb', 'Vegetable'], | ||
['Shallot', 'Vegetable'], | ||
['Spinach', 'Vegetable'], | ||
['Squash', 'Vegetable'], | ||
['Strawberry', 'Fruit'], | ||
['Sweet potato', 'Vegetable'], | ||
['Tomato', 'Fruit'], | ||
['Turnip', 'Vegetable'], | ||
['Ugli fruit', 'Fruit'], | ||
['Victoria plum', 'Fruit'], | ||
['Watercress', 'Vegetable'], | ||
['Watermelon', 'Fruit'], | ||
['Yam', 'Vegetable'], | ||
['Zucchini', 'Vegetable'] | ||
]; | ||
|
||
function searchVeggies (searchString) { | ||
var results = []; | ||
|
||
for (var i = 0; i < FRUITS_AND_VEGGIES.length; i++) { | ||
var veggie = FRUITS_AND_VEGGIES[i][0].toLowerCase(); | ||
if (veggie.indexOf(searchString.toLowerCase()) === 0) { | ||
results.push(FRUITS_AND_VEGGIES[i]); | ||
} | ||
} | ||
|
||
return results; | ||
} | ||
|
||
/** | ||
* @function onload | ||
* @desc Initialize the combobox examples once the page has loaded | ||
*/ | ||
window.addEventListener('load', function () { | ||
var ex1Combobox = new aria.GridCombobox( | ||
document.getElementById('ex1-combobox'), | ||
document.getElementById('ex1-input'), | ||
document.getElementById('ex1-grid'), | ||
searchVeggies | ||
); | ||
|
||
}); |
Oops, something went wrong.