Skip to content

Accessibility, keyboard nav, major bug fixes#5

Merged
dtassone merged 13 commits into
masterfrom
accessibility
May 22, 2020
Merged

Accessibility, keyboard nav, major bug fixes#5
dtassone merged 13 commits into
masterfrom
accessibility

Conversation

@dtassone

Copy link
Copy Markdown
Contributor

Added keyboard navigation/selection, added aria attributes, fix major issue with virtualisation

@dtassone
dtassone merged commit 0ad5f5d into master May 22, 2020
@oliviertassinari
oliviertassinari deleted the accessibility branch May 24, 2020 21:50
<div
className={cssClasses}
role={field + ' cell'}
role={'cell'}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
role={'cell'}
role="cell"

setLoading(true);

loadFile(`./static-data/${type}-${size}.json`).then(
loadFile(`./static-data/${type}-1000.json`).then(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

⚠️ with the clean-up. I would recommend the following: https://github.com/mui-org/material-ui/blob/90babbd13d8dc624ff23453a4e47a311e2758aa6/docs/src/pages/components/autocomplete/Asynchronous.tsx#L23-L43. Notice the active variable that avoids calling setState on an unmounted component (if the request resolves after the unmount).

StatusRenderer,
} from './renderer';

const totalPriceFormatter = ({ value }) => `$ ${Number(value).toLocaleString()}`;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Are you sure about the space between $ and the figures?

console.log(new Intl.NumberFormat("en-US", {style: "currency", currency: "USD"}).format(121));
// $121.00.

} from './renderer';

const totalPriceFormatter = ({ value }) => `$ ${Number(value).toLocaleString()}`;
const pnlFormatter = params =>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We have applied the following coding convention so far: top-level scope => named function, nested-level scope => arrow function. In this context, it would turn into

function pnlFormatter(params) {

if we want to keep following this convention.

import React from 'react';

export function RatingRenderer(params: CellParams) {
return <Rating name={params.data['id'].toString()} value={Number(params.value)} readOnly />;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe?

-return <Rating name={params.data['id'].toString()} value={Number(params.value)} readOnly />;
+return <Rating name={params.data.id.toString()} value={Number(params.value)} readOnly />;

{index != null && (
<Badge badgeContent={index} color="default">
{icons[direction]}
<IconButton aria-label="Sort" size="small">

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We prefer not to capitalize on the label, as far as I know, it makes no difference during pronunciation.

<IconButton aria-label="sort" size="small">


return (
<div ref={ref} className={'title ' + className} {...rest} role={'column-header-title'}>
<div ref={ref} className={'title ' + className} {...rest} role={'column-header-title'} aria-label={label}>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

<div ref={ref} className={'title ' + className} role={'column-header-title'} aria-label={label} {...rest}>

/>
));

return <>{items}</>;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would expect it to work without a Fragment.

return items;

nextCellIndexes.colIndex = nextCellIndexes.colIndex >= colCount ? colCount - 1 : nextCellIndexes.colIndex;

apiRef.current!.scrollToIndexes(nextCellIndexes);
setTimeout(() => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It seems we miss a clean-up.

};
}, []);

//This a hack due to the limitation of react as I cannot put columnsRef in the dependency array of the effect adding the Event listener

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would love to have a chat about how we can improve the approach

@oliviertassinari

oliviertassinari commented May 24, 2020

Copy link
Copy Markdown
Member

Regarding react-hooks/exhaustive-deps I think that it would be valuable to turn the rule into an error. It should almost never be necessary to ignore the rule. From experience, anytime we ignore this warning, a developer will raise a bug, later down the road.

@oliviertassinari

Copy link
Copy Markdown
Member
  • Is it expected that the Grid container can receive the focus?
  • keyboard control can be brittle, adding a test case per command could help.
  • I have just tried Control + Home, pretty cool 👌.
  • Should we send this codesandbox to Josh so he can try it out https://mf8le.csb.app/?
  • I believe the behavior on the header is not correct, in respect to how the sorting can be triggered. However, happy to revisit later.

@dtassone
dtassone restored the accessibility branch May 26, 2020 10:05
@oliviertassinari
oliviertassinari deleted the accessibility branch May 27, 2020 11:03
@dtassone
dtassone restored the accessibility branch May 27, 2020 17:25
@dtassone
dtassone deleted the accessibility branch July 21, 2020 14:33
michaldudak added a commit to michaldudak/mui-x that referenced this pull request Sep 21, 2021
* Make chart docs great again

* [Charts] Fix Popper complaining about not being anchored to a DOM element

* [Charts] Fix infinite render loop in Line
@oliviertassinari oliviertassinari added the scope: data grid Changes related to the data grid. label Jan 17, 2023
@DiegoAndai DiegoAndai mentioned this pull request Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: data grid Changes related to the data grid.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants