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

[DataGrid] Add specific label for linkOperator #3915

Merged
merged 18 commits into from
Mar 2, 2022

Conversation

alexfauquette
Copy link
Member

@alexfauquette alexfauquette commented Feb 10, 2022

Fix #4061

Preview: https://deploy-preview-3915--material-ui-x.netlify.app/components/data-grid/

The demo has two problem:

Screenshot 2022-02-10 at 14 42 25

Pb 1

The link operator has the label "Operators". Thius bug is here from a long time ago. I create a key for linkOperator, and let it empty in all languages, such that dev can customize it.

Pb 2

passing required to the input value does not show the star, so I simply removed it from the demo

@mui-bot
Copy link

mui-bot commented Feb 11, 2022

These are the results for the performance tests:

Test case Unit Min Max Median Mean σ
Filter 100k rows ms 223.9 519.8 266.2 327.62 109.823
Sort 100k rows ms 437.4 914.6 610.1 653.88 158.501
Select 100k rows ms 134.1 293.4 189 200.78 51.659
Deselect 100k rows ms 90.3 236.1 196.7 169.48 51.179

Generated by 🚫 dangerJS against 4d5c8cc

@m4theushw m4theushw self-requested a review February 14, 2022 13:23
@@ -41,6 +41,7 @@ export const GRID_DEFAULT_LOCALE_TEXT: GridLocaleText = {
// Filter panel text
filterPanelAddFilter: 'Add filter',
filterPanelDeleteIconLabel: 'Delete',
filterPanelLinkOperator: '',
Copy link
Member

Choose a reason for hiding this comment

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

We need to add a label. Keeping it empty violates https://www.w3.org/TR/using-aria/#fifthrule

The correct name would be "logic operator" but it's too long. A benchmark might be necessary. For me, "operator" is perfect and "operators" (referring to those like "contains") should be changed to "rule" or "condition". But if we change then we lose sync with the translation constant. Anyway, the API uses some confusing names for the filter model: #1722 (comment)

Copy link
Member Author

Choose a reason for hiding this comment

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

"logic operator" seems good. From what I see in other tables, they nether display the label (And/Or) is clear enough, except notion which adds an helper: "All filters much match"

image

We can add it to the aria-label of the input, and not show it on top of the input

Copy link
Member

Choose a reason for hiding this comment

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

Removing the label may not be ideal, there's no demo without it. We could experiment with the ToggleButton. It doesn't require a visible label. There's also a demo using a Menu.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think ToggleButton is a good option. We already have a lot of information on the page. Showing both "And" and "Or" options will add confusion.
About the Menu demo, I don't see the difference.

The demo is using a combination of aria-label and aria-labelledby to compensate the missing label, plus some role: 'listbox', aria-haspopup="listbox", ... to respect a11y.

The current solution add aria-label to compensate the missing label, and we use meaning full HTML (select and option) to let the screen reader understand the structure.

If your point is that selects accessibility does not contain demo without label, I think the topic of this section is mostly how to add a label on Select component

Copy link
Member

Choose a reason for hiding this comment

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

It may look a bit weird if the user changes the variant to filled but the current approach fixes the accessibility.

image

Copy link
Member Author

Choose a reason for hiding this comment

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

In such a case it would be nice to have a way to add a label, but I do not see how to make that easy to find for developers.

What do you think about wanting to see if some users require to display the label?

@@ -41,6 +41,7 @@ export const GRID_DEFAULT_LOCALE_TEXT: GridLocaleText = {
// Filter panel text
filterPanelAddFilter: 'Add filter',
filterPanelDeleteIconLabel: 'Delete',
filterPanelLinkOperator: '',
filterPanelOperators: 'Operators',
Copy link
Member

Choose a reason for hiding this comment

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

I don't know why it's in plural but it refers to the current value. The same for "Columns".

Suggested change
filterPanelOperators: 'Operators',
filterPanelOperators: 'Operator',

@@ -65,9 +65,6 @@ export default function CustomFilterPanelContent() {
size: 'small',
sx: { mt: 'auto' },
},
valueInputProps: {
Copy link
Member

Choose a reason for hiding this comment

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

Is it possible to make all fields in the filter panel outlined?
I was playing with it a bit and wasn't able to make value input outlined.

Copy link
Member Author

Choose a reason for hiding this comment

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

Not easily, because the value input component can be any thing developer wants.

By default, we set variant="standard" in GridFilterInputValue
https://github.com/alexfauquette/material-ui-x/blob/refacto-export-button/packages/grid/_modules_/grid/components/panel/filterPanel/GridFilterInputValue.tsx#L128:L128

To customize them, developers can edit operators. To make them outlined thy should add to the default operators InputComponentProps: {variant: "outlined"}

Copy link
Member

@m4theushw m4theushw left a comment

Choose a reason for hiding this comment

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

The "margin" between the logic operators and the columns select is missing. Actually it's not a margin but only the select not taking the full width. Now we need to add a margin to compensate.

In https://deploy-preview-3915--material-ui-x.netlify.app/components/data-grid/

image

In https://mui.com/components/data-grid/demo/

image

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Feb 17, 2022
@github-actions
Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Feb 23, 2022
@github-actions
Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Feb 25, 2022
@github-actions github-actions bot added PR: out-of-date The pull request has merge conflicts and can't be merged and removed PR: out-of-date The pull request has merge conflicts and can't be merged labels Feb 25, 2022
@github-actions
Copy link

github-actions bot commented Mar 1, 2022

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Mar 1, 2022
@alexfauquette alexfauquette merged commit 995ea7d into mui:master Mar 2, 2022
@alexfauquette alexfauquette deleted the filterPannel-typos branch March 2, 2022 19:15
@m4theushw m4theushw mentioned this pull request Apr 27, 2022
41 tasks
@oliviertassinari oliviertassinari added the component: data grid This is the name of the generic UI component, not the React module! label Jan 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: data grid This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[DataGrid] GridFilterPanel UI Issue
6 participants