Skip to content
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

Merged
merged 14 commits into from
Jun 10, 2019
Merged

Conversation

mrchief
Copy link
Collaborator

@mrchief mrchief commented May 18, 2019

BREAKING CHANGE: showDropdown & showDropdownAlways props are merged

showDropdown and showDropdownAlways props are now moved under showDropdown prop.

// before
<DropdownTreeSelect data={data} showDropdown />

// after
<DropdownTreeSelect data={data} showDropdown="initial" />

showDropdown: always

// before
<DropdownTreeSelect data={data} showDropdownAlways />

// after
<DropdownTreeSelect data={data} showDropdown="always" />

ellinge and others added 4 commits May 9, 2019 16:12
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" />
```
@coveralls
Copy link

coveralls commented May 20, 2019

Pull Request Test Coverage Report for Build 1205

  • 9 of 9 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.4%) to 94.668%

Totals Coverage Status
Change from base Build 1203: 0.4%
Covered Lines: 565
Relevant Lines: 580

💛 - Coveralls

ellinge
ellinge previously approved these changes May 20, 2019
}

if (/multiSelect|hierarchical/.test(mode)) {
attributes['aria-multiselectable'] = true
Copy link
Collaborator

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',
    }

Copy link
Collaborator Author

@mrchief mrchief May 20, 2019

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

Copy link
Collaborator

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.

Copy link
Collaborator Author

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.

mrchief and others added 2 commits May 20, 2019 22:01
# 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
@stale
Copy link

stale bot commented Jun 5, 2019

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.

@stale stale bot added the stale label Jun 5, 2019
@stale stale bot removed the stale label Jun 5, 2019
@codeclimate
Copy link

codeclimate bot commented Jun 5, 2019

Code Climate has analyzed commit b18136d and detected 0 issues on this pull request.

View more on Code Climate.

@mrchief mrchief merged commit 297ed42 into develop Jun 10, 2019
@mrchief mrchief deleted the feat/group_showDropdown branch June 10, 2019 02:08
mrchief added a commit that referenced this pull request Jun 10, 2019
* 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' }}` |
mrchief added a commit that referenced this pull request Jun 10, 2019
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' }}` |
mrchief added a commit that referenced this pull request Jun 10, 2019
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' }}` |
mrchief pushed a commit that referenced this pull request Jun 16, 2019
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:
mrchief pushed a commit that referenced this pull request Jun 16, 2019
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:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants