-
Notifications
You must be signed in to change notification settings - Fork 352
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
docs(Table): add Editable Table example #10341
docs(Table): add Editable Table example #10341
Conversation
Preview: https://patternfly-react-pr-10341.surge.sh A11y report: https://patternfly-react-pr-10341-a11y.surge.sh |
a67cea7
to
acd45ff
Compare
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.
Looks like the example is erroring out for some reason on the surge build, but it works locally, not sure what's going on there.
What's the deal with importing each react-core component from dist individually? I tried changing that to a normal import locally and it didn't seem to cause any issues.
I do also wonder if this should be a demo instead of an example with how many react-core components it's using 🤔
Other than those questions though this looks awesome 🚀
The example error in the surge build is probably because the surge build is old (I then force pushed another commit), and I was using a generic component in the previous commit and it could not parse the syntax. About the individual imports from dist, I at first thought we should import each file individually when importing to another package, the same way we import icons (I read this article from Martin, but I misunderstood it). |
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.
🔥
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.
when using a keyboard to edit the rows, the browser focus gets lost when toggling between edit and non-edit states since the buttons disappear. We might need to move focus intentionally when you use keyboard to click pencil icon or save/cancel icons.
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.
Couple of comments below. Additionally, there's some markup issues with the table itself:
- There needs to be a
Th
component for the editable buttons column. If we want to keep it blank, then screenreadertext needs to be supplied such as "Row edit actions". See the table with actiosn example - The edit buttons (edit, save, close) need to be wrapped in a
Td
. Right now thediv
wrappers are rendered as chlldren totr
Both of the above issues cause the edit buttons not to be navigable via screen reader since semantically there's no valid table cells to navigate to.
<div className={css(inlineEditStyles.inlineEditGroup, inlineEditStyles.modifiers.iconGroup, 'pf-m-action-group')}> | ||
<div className={css(inlineEditStyles.inlineEditAction, inlineEditStyles.modifiers.valid)}> | ||
<Button | ||
aria-label={saveAriaLabel} |
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.
For this, the cancel button, and the edit button, we should have unique aria-labels for each row. E.g. "Edit row 1" or something
dataLabel={columnNames.textInput} | ||
staticValue={data.textInput} | ||
editingValue={ | ||
<TextInput |
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.
These textinputs should have an aria-label
<EditableCell | ||
dataLabel={columnNames.checkboxes} | ||
staticValue={data.checkboxes.join(', ')} | ||
editingValue={dataOptions?.checkboxes.map((option) => { |
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.
Only other thing is that the checkboxes and radios for each row should be wrapped in a pf-v5-c-inline-edit__group pf-m-column
element, with the checkbox group having role="group"
and radios having role="radiogroup"
. Each should also have an aria-label to the group container. Core markup (core needs to be updated to add the role and aria label to the checkbox group):
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.
Other than the lint error lgtm 😎
Your changes have been released in:
Thanks for your contribution! 🎉 |
What: Closes #6597