From bf94e8d329d26c8eb2a0b67aadaef1f8e93a0261 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustav=20Ton=C3=A9r?= Date: Tue, 2 Apr 2019 09:12:52 +0200 Subject: [PATCH 01/31] feat: Add aria roles and attributes --- src/index.js | 2 +- src/tree-node/index.js | 2 +- src/tree-node/index.test.js | 28 ++++++++++++++++++++++++++++ src/tree/index.js | 4 ++-- src/tree/index.test.js | 6 ++++++ 5 files changed, 38 insertions(+), 4 deletions(-) diff --git a/src/index.js b/src/index.js index e5bff6dc..7698f729 100644 --- a/src/index.js +++ b/src/index.js @@ -201,7 +201,7 @@ class DropdownTreeSelect extends Component { }} >
- + { this.searchInput = el diff --git a/src/tree-node/index.js b/src/tree-node/index.js index 7ad49dda..14a627ca 100644 --- a/src/tree-node/index.js +++ b/src/tree-node/index.js @@ -88,7 +88,7 @@ class TreeNode extends PureComponent { const style = keepTreeOnSearch || !searchModeOn ? { paddingLeft: `${(_depth || 0) * 20}px` } : {} return ( -
  • +
  • { t.is(wrapper.prop('data-first'), 'john') t.is(wrapper.prop('data-last'), 'smith') }) + +test('should set aria-selected to true for checked nodes', t => { + const node = { + _id: '0-0-0', + _parent: '0-0', + label: 'item0-0-0', + value: 'value0-0-0', + className: 'cn0-0-0', + checked: true + } + + const wrapper = mount() + t.is(wrapper.prop('aria-selected', true)) +}) + +test('should set aria-selected to false for unchecked nodes', t => { + const node = { + _id: '0-0-0', + _parent: '0-0', + label: 'item0-0-0', + value: 'value0-0-0', + className: 'cn0-0-0', + checked: false + } + + const wrapper = mount() + t.is(wrapper.prop('aria-selected', false)) +}) diff --git a/src/tree/index.js b/src/tree/index.js index dd46ab58..19bdf7f2 100644 --- a/src/tree/index.js +++ b/src/tree/index.js @@ -99,10 +99,10 @@ class Tree extends Component { } render() { - const { searchModeOn } = this.props + const { readOnly, searchModeOn } = this.props return ( -
  • @@ -446,14 +451,9 @@ Generated by [AVA](https://ava.li).
    - - +
    diff --git a/__snapshots__/src/index.test.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__/src/trigger/index.test.js.md b/__snapshots__/src/trigger/index.test.js.md new file mode 100644 index 00000000..07d7dc47 --- /dev/null +++ b/__snapshots__/src/trigger/index.test.js.md @@ -0,0 +1,19 @@ +# Snapshot report for `src\trigger\index.test.js` + +The actual snapshot is saved in `index.test.js.snap`. + +Generated by [AVA](https://ava.li). + +## Trigger component + +> Snapshot 1 + + diff --git a/__snapshots__/src/trigger/index.test.js.snap b/__snapshots__/src/trigger/index.test.js.snap new file mode 100644 index 0000000000000000000000000000000000000000..5136123cf735ddc769c61c893803cb4380307eab GIT binary patch literal 344 zcmV-e0jK^!RzV1QGP^MJCC%M$_G}+1U2v#i!`4;K}C@L~kAi z-$f^dloDL{+1-D>nPFxO00{3#KVQcmliTmr@N?aM9w1cbl`jiM6@dYI^hjZzmD5y) zT2O4TIu^Pq1B$g`y|HXgJ7k@(ZdiS61&HMNeRKlsTu1k!O5Q$w-?x6B0QUeLz$QY_E7P@`o_t8Ck?6O~-HiMWQM q3!ZYZF>K!Xki&KW-ezs?c`0L)Dv8$4r(WFwp!ElY6x4~z0RR9-prD=r literal 0 HcmV?d00001 diff --git a/src/index.js b/src/index.js index e2b2b2c3..387ddac4 100644 --- a/src/index.js +++ b/src/index.js @@ -11,8 +11,8 @@ import PropTypes from 'prop-types' import React, { Component } from 'react' import { isOutsideClick, clientIdGenerator } from './utils' -import { getAriaLabel } from './a11y' import Input from './input' +import Trigger from './trigger' import Tree from './tree' import TreeManager from './tree-manager' import keyboardNavigation from './tree-manager/keyboardNavigation' @@ -210,34 +210,7 @@ class DropdownTreeSelect extends Component { this.keepDropdownActive = false } - getAriaAttributes = () => { - const { showDropdown } = this.state - const { simpleSelect, label } = this.props - - const attributes = { - role: 'button', - tabIndex: 0, - 'aria-haspopup': simpleSelect ? 'listbox' : 'tree', - 'aria-expanded': showDropdown ? 'true' : 'false', - ...getAriaLabel(label), - } - - return attributes - } - - handleTrigger = e => { - // Just return if triggered from keyDown and the key isn't enter, space or arrow down - if (e.key && e.keyCode !== 13 && e.keyCode !== 32 && e.keyCode !== 40) { - return - } else if (e.key && this.triggerNode && this.triggerNode !== document.activeElement) { - // Do not trigger if not activeElement - return - } else if (!this.state.showDropdown && e.keyCode === 32) { - // Avoid adding space to input on open - e.preventDefault() - } - - // Else this is a key press that should trigger the dropdown + onTrigger = e => { this.handleClick(e, () => { // If the dropdown is shown after key press, focus the input if (this.state.showDropdown) { @@ -289,19 +262,13 @@ class DropdownTreeSelect extends Component { } render() { - const { disabled, readOnly, simpleSelect, radioSelect } = this.props + const { disabled, readOnly, simpleSelect, radioSelect, label } = this.props const { showDropdown } = this.state - const dropdownTriggerClassname = cx({ - 'dropdown-trigger': true, - arrow: true, - disabled, - readOnly, - top: showDropdown, - bottom: !showDropdown, - }) const activeDescendant = this.state.currentFocus ? `${this.state.currentFocus}_li` : undefined + const commonProps = { disabled, readOnly, activeDescendant, label, simpleSelect, radioSelect } + return (
    - { - this.triggerNode = node - }} - className={dropdownTriggerClassname} - onClick={!this.props.disabled ? this.handleTrigger : undefined} - onKeyDown={!this.props.disabled ? this.handleTrigger : undefined} - {...this.getAriaAttributes()} - > + { this.searchInput = el @@ -331,13 +290,10 @@ class DropdownTreeSelect extends Component { onBlur={this.onInputBlur} onTagRemove={this.onTagRemove} onKeyDown={this.onKeyboardKeyDown} - disabled={disabled} - readOnly={readOnly} - activeDescendant={activeDescendant} - label={this.props.label} labelRemove={this.props.labelRemove} + {...commonProps} /> - + {showDropdown && (
    {this.state.allNodesHidden ? ( @@ -351,12 +307,9 @@ class DropdownTreeSelect extends Component { onAction={this.onAction} onCheckboxChange={this.onCheckboxChange} onNodeToggle={this.onNodeToggle} - simpleSelect={simpleSelect} - radioSelect={radioSelect} showPartiallySelected={this.props.showPartiallySelected} - readOnly={readOnly} clientId={this.clientId} - activeDescendant={activeDescendant} + {...commonProps} /> )}
    diff --git a/src/trigger/index.js b/src/trigger/index.js new file mode 100644 index 00000000..9ae70e5f --- /dev/null +++ b/src/trigger/index.js @@ -0,0 +1,78 @@ +import React, { PureComponent } from 'react' +import PropTypes from 'prop-types' +import cn from 'classnames/bind' + +import { getAriaLabel } from '../a11y' + +import styles from '../index.css' + +const cx = cn.bind(styles) + +class Trigger extends PureComponent { + static propTypes = { + onTrigger: PropTypes.func, + disabled: PropTypes.bool, + readOnly: PropTypes.bool, + showDropdown: PropTypes.bool, + label: PropTypes.string, + } + + getAriaAttributes = () => { + const { simpleSelect, label, showDropdown } = this.props + + const attributes = { + role: 'button', + tabIndex: 0, + 'aria-haspopup': simpleSelect ? 'listbox' : 'tree', + 'aria-expanded': showDropdown ? 'true' : 'false', + ...getAriaLabel(label), + } + + return attributes + } + + handleTrigger = e => { + // Just return if triggered from keyDown and the key isn't enter, space or arrow down + if (e.key && e.keyCode !== 13 && e.keyCode !== 32 && e.keyCode !== 40) { + return + } else if (e.key && this.triggerNode && this.triggerNode !== document.activeElement) { + // Do not trigger if not activeElement + return + } else if (!this.props.showDropdown && e.keyCode === 32) { + // Avoid adding space to input on open + e.preventDefault() + } + + // Else this is a key press that should trigger the dropdown + this.props.onTrigger(e) + } + + render() { + const { disabled, readOnly, showDropdown } = this.props + + const dropdownTriggerClassname = cx({ + 'dropdown-trigger': true, + arrow: true, + disabled, + readOnly, + top: showDropdown, + bottom: !showDropdown, + }) + + return ( + { + this.triggerNode = node + }} + className={dropdownTriggerClassname} + onClick={!disabled ? this.handleTrigger : undefined} + onKeyDown={!disabled ? this.handleTrigger : undefined} + {...this.getAriaAttributes()} + > + {this.props.children} + + ) + } +} + +export default Trigger diff --git a/src/trigger/index.test.js b/src/trigger/index.test.js new file mode 100644 index 00000000..f510af7f --- /dev/null +++ b/src/trigger/index.test.js @@ -0,0 +1,11 @@ +import { shallow } from 'enzyme' +import React from 'react' +import test from 'ava' +import toJson from 'enzyme-to-json' + +import Trigger from './index' + +test('Trigger component', t => { + const input = toJson(shallow()) + t.snapshot(input) +}) From 0a89cd39b31e3d9d769681c3cc68312f99f8f7ec Mon Sep 17 00:00:00 2001 From: Magnus Ellinge Date: Thu, 2 May 2019 00:49:27 +0200 Subject: [PATCH 28/31] fix: Add comment for removing hash --- src/a11y/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/a11y/index.js b/src/a11y/index.js index c6aba6fd..20d54df3 100644 --- a/src/a11y/index.js +++ b/src/a11y/index.js @@ -2,6 +2,7 @@ export function getAriaLabel(label) { if (!label) return undefined if (label && label[0] === '#') { + // If input label reference ids (hash), use a labelledby without hashes return { 'aria-labelledby': label.replace(/#/g, '') } } return { 'aria-label': label } From 11b8ce79688d205b787dddc0ea923763e91380d3 Mon Sep 17 00:00:00 2001 From: Magnus Ellinge Date: Thu, 2 May 2019 00:52:44 +0200 Subject: [PATCH 29/31] fix: Raise duplicate threshold --- .codeclimate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.codeclimate.yml b/.codeclimate.yml index 477883ad..707a839e 100644 --- a/.codeclimate.yml +++ b/.codeclimate.yml @@ -39,7 +39,7 @@ plugins: config: languages: javascript: - mass_threshold : 50 + mass_threshold : 60 exclude_patterns: - "docs/" - "snapshots/" From 6ece934d531a936fed8f6f681caf9102df9b0ab8 Mon Sep 17 00:00:00 2001 From: Magnus Ellinge Date: Thu, 2 May 2019 09:41:14 +0200 Subject: [PATCH 30/31] fix: Expand on comment for hash replacement --- src/a11y/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/a11y/index.js b/src/a11y/index.js index 20d54df3..00410ab3 100644 --- a/src/a11y/index.js +++ b/src/a11y/index.js @@ -2,7 +2,8 @@ export function getAriaLabel(label) { if (!label) return undefined if (label && label[0] === '#') { - // If input label reference ids (hash), use a labelledby without hashes + /* See readme for label. When label starts with # it references ids of dom nodes instead. + When used on aria-labelledby, they should reference the nodes with a starting hash/# */ return { 'aria-labelledby': label.replace(/#/g, '') } } return { 'aria-label': label } From 791ff7576fdafa934248cff3bfd8a6f46095dbc5 Mon Sep 17 00:00:00 2001 From: Magnus Ellinge Date: Thu, 2 May 2019 09:44:51 +0200 Subject: [PATCH 31/31] fix: Expand on comment for hash replacement --- src/a11y/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/a11y/index.js b/src/a11y/index.js index 00410ab3..fac78b08 100644 --- a/src/a11y/index.js +++ b/src/a11y/index.js @@ -3,7 +3,7 @@ export function getAriaLabel(label) { if (label && label[0] === '#') { /* See readme for label. When label starts with # it references ids of dom nodes instead. - When used on aria-labelledby, they should reference the nodes with a starting hash/# */ + When used on aria-labelledby, they should be referenced without a starting hash/# */ return { 'aria-labelledby': label.replace(/#/g, '') } } return { 'aria-label': label }