-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Accessibility, keyboard nav, major bug fixes #5
Conversation
@@ -26,10 +41,14 @@ export const Cell: React.FC<GridCellProps> = React.memo( | |||
return ( | |||
<div | |||
className={cssClasses} | |||
role={field + ' cell'} | |||
role={'cell'} |
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.
role={'cell'} | |
role="cell" |
@@ -31,8 +31,17 @@ export const CommodityGridDemo: React.FC<{}> = props => { | |||
setCols(gridColumns); | |||
setLoading(true); | |||
|
|||
loadFile(`./static-data/${type}-${size}.json`).then( | |||
loadFile(`./static-data/${type}-1000.json`).then( |
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.
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()}`; |
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.
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 => |
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 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 />; |
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.
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 />;
@@ -19,10 +20,16 @@ export const ColumnHeaderSortIcon: React.FC<ColumnHeaderSortIconProps> = React.m | |||
<span className={'sort-icon'}> | |||
{index != null && ( | |||
<Badge badgeContent={index} color="default"> | |||
{icons[direction]} | |||
<IconButton aria-label="Sort" size="small"> |
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 prefer not to capitalize on the label, as far as I know, it makes no difference during pronunciation.
<IconButton aria-label="sort" size="small">
@@ -7,7 +7,7 @@ const ColumnHeaderInnerTitle = React.forwardRef<HTMLDivElement, any>((props, ref | |||
const { label, className, ...rest } = props; | |||
|
|||
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}> |
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.
<div ref={ref} className={'title ' + className} role={'column-header-title'} aria-label={label} {...rest}>
/> | ||
)); | ||
|
||
return <>{items}</>; |
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 would expect it to work without a Fragment.
return items;
nextCellIndexes.colIndex = nextCellIndexes.colIndex >= colCount ? colCount - 1 : nextCellIndexes.colIndex; | ||
|
||
apiRef.current!.scrollToIndexes(nextCellIndexes); | ||
setTimeout(() => { |
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.
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 |
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 would love to have a chat about how we can improve the approach
Regarding |
|
* Make chart docs great again * [Charts] Fix Popper complaining about not being anchored to a DOM element * [Charts] Fix infinite render loop in Line
Added keyboard navigation/selection, added aria attributes, fix major issue with virtualisation