Skip to content

Commit a4fb879

Browse files
ellingemrchief
authored andcommitted
feat: Add keyboard navigation (dowjones#225)
* feat: Test try a11y in test with axe * fix: Initial commit (non working) * fix: Working keyboard navigation * fix: Backspace only on empty search * fix: Adjust code to check codeclimate * fix: Refactored some parts to utils * fix: Refactored some parts to utils * fix: Code refactoring * fix: Add documentation * fix: Refactor * fix: Refactor * fix: Refactor * fix: Refactor * fix: Refactor * fix: Add to typings * fix: Close on Enter * fix: Refactor * fix: Added test * fix: Added some aria * fix: Add label option * fix: Render until node on pagedown * fix: More tests added and fix pagedown on large search result * fix: Modify output on violations * fix: Code smells * fix: Updated doc and center scrollIntoView, fix hasMore() * fix: Trigger on*-events properly, only open for chars and whitelist * fix: Skip som aria in this branch * fix: Add tests and fix snapshot * fix: Add tests and fix snapshot * fix: Enabled by default * fix: Avoid scroll of whole page, only dropdown * fix: Remember focus during prop updates * fix: Delete unintentional dist-file * fix: Do not select readOnly/disabled * fix: Switch to babel-plugin-transform-runtime instead * fix: Add label to trigger as well * fix: Highlight tag on focus, ad aria-labels * fix: Highlight tag on focus, ad aria-labels * fix: Update snapshots, match default * fix: Allow navigate to disabled/readonly * fix: Code review/smells fixes * fix: Code smell * fix: Code smell * fix: Move to a11y-folder, shared onKeyDown test method * fix: Build error and tabIndex * fix: Set new focus after delete * fix: Code climate * fix: Code climate * fix: Select on tab for simpleSelect * fix: Add more tests * fix: Add prop for setting remove aria-label * fix: Code climate * fix: Add typing for labelRemove * fix: Adjust timeout * style: Bring prettier manually to reduce conflicts * fix: Prettier and removed comment * fix: Added migration guide * fix: Bundle text props * fix: Typing errors * fix: Renamed prop * Revert "fix: Renamed prop" This reverts commit 4145f8c. * Revert "fix: Typing errors" This reverts commit 6aa4beb. * Revert "fix: Bundle text props" This reverts commit 4256ce2. * Revert "fix: Added migration guide" This reverts commit a4fc033. * fix: Validate radioSelect also * fix: Moved around methods * refactor: Separate out test utils from exported ones * refactor: Use ES6 getter instead of custom method for accessing tags
1 parent 4e1d5af commit a4fb879

34 files changed

+1074
-266
lines changed

Diff for: .babelrc

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
{
22
"presets": [["es2015", { "modules": false }], "stage-0", "react"],
3-
"plugins": ["transform-class-properties"],
3+
"plugins": [
4+
"transform-class-properties",
5+
["transform-runtime", { "polyfill": false, "regenerator": true }]
6+
],
47
"env": {
58
"test": {
69
"presets": ["es2015", "stage-0", "react"],

Diff for: .codeclimate.yml

+5-6
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,8 @@ plugins:
4141
javascript:
4242
mass_threshold : 50
4343
exclude_patterns:
44-
- 'docs/'
45-
- 'snapshots/'
46-
- '**/tests/*'
47-
- '**/node_modules/'
48-
- '**/*.test.js'
49-
- 'postcss.config.js'
44+
- "docs/"
45+
- "snapshots/"
46+
- "**/tests/*"
47+
- "**/node_modules/"
48+
- "**/*.test.js"

Diff for: README.md

+21
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ A lightweight and fast control to render a select component that can display hie
5757
- [showDropdownAlways](#showDropdownAlways)
5858
- [form states (disabled|readOnly)](#formstates)
5959
- [id](#id)
60+
- [label](#label)
61+
- [labelRemove](#labelRemove)
6062
- [Styling and Customization](#styling-and-customization)
6163
- [Using default styles](#default-styles)
6264
- [Customizing with Bootstrap, Material Design styles](#customizing-styles)
@@ -65,6 +67,7 @@ A lightweight and fast control to render a select component that can display hie
6567
- [Search debouncing](#search-debouncing)
6668
- [Virtualized rendering](#virtualized-rendering)
6769
- [Reducing costly DOM manipulations](#reducing-costly-dom-manipulations)
70+
- [Keyboard navigation](#keyboard-navigation)
6871
- [FAQ](#faq)
6972
- [Doing more with HOCs](/docs/HOC.md)
7073
- [Development](#development)
@@ -363,6 +366,18 @@ Specific id for container. The container renders with a default id of `rdtsN` wh
363366

364367
Use to ensure a own unique id when a simple counter is not sufficient, e.g in a partial server render (SSR)
365368

369+
### label
370+
371+
Type: `string`
372+
373+
Adds `aria-labelledby` to search input when input starts with `#`, adds `aria-label` to search input when label has value (not containing '#')
374+
375+
### labelRemove
376+
377+
Type: `string`
378+
379+
The text to display for `aria-label` on tag delete buttons which is combined with `aria-labelledby` pointing to the node label. Defaults to `Remove`
380+
366381
## Styling and Customization
367382

368383
### Default styles
@@ -414,6 +429,12 @@ Once you import default styles, it is easy to add/override the provided styles t
414429
- [With Bootstrap](/docs/examples/bootstrap)
415430
- [With Material Design ](/docs/examples/material)
416431

432+
## Keyboard navigation
433+
434+
Adds navigation with `arrow` keys, `page down/up` / `home/end` and toggle of selection with `enter`. `Arrow/page up/down` also toggles open of dropdown if closed.
435+
436+
To close open dropdown `escape` or `tab` can be used and `backspace` can be used for deletion of tags on empty search input.
437+
417438
## Performance
418439

419440
### Search optimizations

0 commit comments

Comments
 (0)