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

docs(Table): add Editable Table example #10341

Merged
merged 6 commits into from
Jul 16, 2024

Conversation

adamviktora
Copy link
Contributor

@adamviktora adamviktora commented May 6, 2024

What: Closes #6597

@patternfly-build
Copy link
Contributor

patternfly-build commented May 6, 2024

@adamviktora adamviktora force-pushed the table-editable-example branch from a67cea7 to acd45ff Compare May 9, 2024 18:51
@adamviktora adamviktora marked this pull request as ready for review May 9, 2024 18:51
@adamviktora adamviktora requested review from mturley, a team, wise-king-sullyman and nicolethoen and removed request for a team May 9, 2024 18:57
Copy link
Contributor

@wise-king-sullyman wise-king-sullyman left a 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 🚀

@adamviktora
Copy link
Contributor Author

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).

Copy link
Contributor

@wise-king-sullyman wise-king-sullyman left a comment

Choose a reason for hiding this comment

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

🔥

Copy link
Contributor

@nicolethoen nicolethoen left a 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.

@adamviktora adamviktora requested a review from nicolethoen May 22, 2024 11:44
Copy link
Contributor

@thatblindgeye thatblindgeye left a 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 the div wrappers are rendered as chlldren to tr

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}
Copy link
Contributor

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
Copy link
Contributor

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) => {
Copy link
Contributor

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):

image

Copy link
Contributor

@thatblindgeye thatblindgeye left a 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 😎

@thatblindgeye thatblindgeye merged commit 1779fcd into patternfly:main Jul 16, 2024
13 checks passed
@patternfly-build
Copy link
Contributor

Your changes have been released in:

Thanks for your contribution! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add example: Composable Table with editable rows
5 participants