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

fix(data-table): use unselectAll translation key if selection checkbox is indeterminate #4570

Merged
merged 2 commits into from
Nov 6, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions packages/react/src/components/DataTable/DataTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -315,9 +315,10 @@ export default class DataTable extends React.Component {
const checked = rowCount > 0 && selectedRowCount === rowCount;
const indeterminate =
rowCount > 0 && selectedRowCount > 0 && selectedRowCount !== rowCount;
const translationKey = checked
? translationKeys.unselectAll
: translationKeys.selectAll;
const translationKey =
checked || indeterminate
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
checked || indeterminate
(checked || indeterminate)

Does prettier end up taking away the parenthesis here? There seems to be some syntax ambiguity that adding these in might help with. Otherwise, seems great!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah prettier will remove parentheses there. by default it is evaluated as (checked || indeterminate) ? ... : ... rather than checked || (indeterminate ? ... : ...)

? translationKeys.unselectAll
: translationKeys.selectAll;
return {
...rest,
ariaLabel: t(translationKey),
Expand Down