-
Notifications
You must be signed in to change notification settings - Fork 266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: Consolidate showDropdown props #253
Conversation
BREAKING: Property changes | Description | Usage before | Usage after | | --------------------------------------- | ----------------------------------------------------------- | ------------------------------------------------------------- | | Added a new `mode` prop | `simpleSelect={true}` / `simpleSelect` | `mode='simpleSelect'` | | Bundled text props into a single object | `placeholderText='My text'`<br>`noMatchesText='No matches'` | `texts={{ placeholder: 'My text', noMatches: 'No matches' }}` |
BREAKING: `hierarchical` prop `hierarchical` prop is now moved under `mode` prop. ``` // before <DropdownTreeSelect data={data} hierarchical={true} /> // after <DropdownTreeSelect data={data} mode="hierarchical" /> ```
Pull Request Test Coverage Report for Build 1205
💛 - Coveralls |
src/tree/index.js
Outdated
} | ||
|
||
if (/multiSelect|hierarchical/.test(mode)) { | ||
attributes['aria-multiselectable'] = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason for 'true' : 'false' before is because that forces the values to be outputted, not only on true (boolean true).
Not sure if we should keep that (does not seem to cause any a11y-errors when running tests)
return {
/* https://www.w3.org/TR/wai-aria-1.1/#select
* https://www.w3.org/TR/wai-aria-1.1/#tree */
role: mode === 'simpleSelect' ? 'listbox' : 'tree',
'aria-multiselectable': /multiSelect|hierarchical/.test(mode) ? 'true' : 'false',
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this needs revisiting. It was complaining about them earlier but that could have been due to something else.
If all passes now, then we can keep the true/false
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need them to be strings for them to be emitted on false also.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the reason a11y tests pass is because of this:
from https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role
aria-multiselectable
Include and set to true if the user can select more than one option. If set to true, every option should have a the aria-selected attribute included. If false or omitted, only the currently selected option, if any option is selected, needs the aria-selected attribute, and it must be set to true.
So going by this, it's ok to omit for single select cases.
# Conflicts: # README.md # __snapshots__/src/index.test.js.md # __snapshots__/src/index.test.js.snap # docs/src/stories/Options/index.js # src/a11y/a11y.test.js # src/index.js # src/index.test.js # src/tree-manager/tests/radioSelect.test.js # src/tree/index.js # types/react-dropdown-tree-select.d.ts
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Code Climate has analyzed commit b18136d and detected 0 issues on this pull request. View more on Code Climate. |
* feat: Group logically related props together (#242) ⚡️ BREAKING CHANGE: Property changes | Description | Usage before | Usage after | | --------------------------------------- | ----------------------------------------------------------- | ------------------------------------------------------------- | | Added a new `mode` prop | `simpleSelect={true}` / `simpleSelect` | `mode='simpleSelect'` | | Bundled text props into a single object | `placeholderText='My text'`<br>`noMatchesText='No matches'` | `texts={{ placeholder: 'My text', noMatches: 'No matches' }}` |
BREAKING CHANGE: Property changes | Description | Usage before | Usage after | | --------------------------------------- | ----------------------------------------------------------- | ------------------------------------------------------------- | | Added a new `mode` prop | `simpleSelect={true}` / `simpleSelect` | `mode='simpleSelect'` | | Bundled text props into a single object | `placeholderText='My text'`<br>`noMatchesText='No matches'` | `texts={{ placeholder: 'My text', noMatches: 'No matches' }}` |
BREAKING CHANGE: Property changes | Description | Usage before | Usage after | | --------------------------------------- | ----------------------------------------------------------- | ------------------------------------------------------------- | | Added a new `mode` prop | `simpleSelect={true}` / `simpleSelect` | `mode='simpleSelect'` | | Bundled text props into a single object | `placeholderText='My text'`<br>`noMatchesText='No matches'` | `texts={{ placeholder: 'My text', noMatches: 'No matches' }}` |
Keeps dropdown open if updating with new props. Only updates/sets state open if new props cause the dropdown to show (a.k.a `initial`/`always`) #253 introduced resetting of state for shopDropdown on new props:
Keeps dropdown open if updating with new props. Only updates/sets state open if new props cause the dropdown to show (a.k.a `initial`/`always`) #253 introduced resetting of state for shopDropdown on new props:
BREAKING CHANGE:
showDropdown
&showDropdownAlways
props are mergedshowDropdown
andshowDropdownAlways
props are now moved undershowDropdown
prop.showDropdown: always