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

fix(mantine, table): fix a few bugs when table is disabled by fieldset #3272

Closed
wants to merge 3 commits into from

Conversation

agong-coveo
Copy link
Collaborator

@agong-coveo agong-coveo commented May 15, 2023

Proposed Changes

This PR tackles a few bugs that arise when a Table component is wrapped inside a fieldset. Essentially:

  • If a table's rows contain checkboxes, despite being disabled, the checkboxes are still toggable when a user clicks on the row itself:
Bug.B.mov
  • Also, after the changes made in this PR in Mantine, when bumping the mantine dependecies to the latest, the collapsible buttons are now disabled and its content becomes inaccessible. This is a bug since we still want users to be able to access the collapsed content.
Screenshot 2023-05-17 at 11 43 30 AM

The changes made to fix the bugs are the following:

  • Modified the onClick method of the rows to take into account if its checkbox is disabled or not. If it is, then onClick is undefined;
  • Modified the disabled style of the collapsible button to be clickable and to look enabled.

NOTE: Currently, there is also a bug with the Pagination and the PerPage component that is in a Table's footer. More precisely, these components are disabled and unclickable. This is an issue because users should still be able to view the items inside a table and be able to manipulate these components. This task was created to tackle it.

Potential Breaking Changes

None

Acceptance Criteria

  • The proposed changes are covered by unit tests
  • The potential breaking changes are clearly identified
  • README.md is adjusted to reflect the proposed changes (if relevant)

@github-actions
Copy link

github-actions bot commented May 15, 2023

Dependency Review

✅ No vulnerabilities or license issues found.

Scanned Manifest Files

@agong-coveo agong-coveo force-pushed the fix/CTCORE-9193-fieldset-disabled-table branch from 2cafec0 to 9cbd4b6 Compare May 17, 2023 15:31
@github-actions
Copy link

@agong-coveo agong-coveo changed the title Fix/ctcore 9193 fieldset disabled table fix(mantine, Table): fix a few bugs when table is disabled by fieldset May 17, 2023
@agong-coveo agong-coveo changed the title fix(mantine, Table): fix a few bugs when table is disabled by fieldset fix(mantine, table): fix a few bugs when table is disabled by fieldset May 17, 2023
@agong-coveo agong-coveo marked this pull request as ready for review May 17, 2023 16:14
@agong-coveo agong-coveo requested a review from a team as a code owner May 17, 2023 16:14
@agong-coveo agong-coveo requested review from gdostie and dmgauthier and removed request for a team May 17, 2023 16:14
packages/mantine/src/components/table/Table.styles.ts Outdated Show resolved Hide resolved
Comment on lines +134 to +138
onClick={() =>
rowRef.current.querySelectorAll('.mantine-Table-root input[type=checkbox]:disabled').length > 0
? undefined
: row.toggleSelected()
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Row selection should still be enabled even when inside a disabled fieldset in some cases. Some row actions are still valid even in read-only mode.

For example, we often have a table row action that opens another panel to view the details of the resource represented by the row. Even if the table is disabled you still want to be able to view the resource's details.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I see! From the examples in tanstack, I seem to have understood that row selection was for selecting and toggling the checkboxes associated to a row.

I'm not sure I understand the example completely. Are these details hidden inside a collapsible? Something like in the Sources panel?
image
If that's the case, if I'm not mistaken, this content becomes visible only when the user clicks on the arrow button and not on the row itself. The change here shouldn't affect access to the resource's details.

Copy link
Collaborator

@gdostie gdostie May 17, 2023

Choose a reason for hiding this comment

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

You have an example of what I am referring to in your screenshot. In the table actions, we can see "Rescan", "Edit", "Activity", "... More". Those buttons still need to be activated even inside a disabled fieldset. Granted, not all of them, but the "Activity" one does, and the "... More" as well. The predicate filter and the text search filter too still need to be functional.

@gdostie
Copy link
Collaborator

gdostie commented May 17, 2023

Another concern of mine is sorting, what happens if you want to sort a table that is inside a disabled fieldset. Tables are more often than not presentational components rather than form control.

@agong-coveo agong-coveo requested a review from toofff May 17, 2023 18:15
@agong-coveo
Copy link
Collaborator Author

Another concern of mine is sorting, what happens if you want to sort a table that is inside a disabled fieldset. Tables are more often than not presentational components rather than form control.

I absolutely agree with the fact that tables are more often presentational, which is why I think that everything should remain visible to the user even when it is disabled. When testing the component with a fieldset, I tried to make sure that despite being disabled, all items and content of the table are accessible. The sorting in this case isn't affected, and users can still sort a table without any issue even when it is disabled. Users are also able to access collapsed content and double clicking on a row is enabled as well. However, pagination right now still remains a problem, and a task has been created for this issue.

@agong-coveo
Copy link
Collaborator Author

Closed because the description of the task has changed.

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.

None yet

2 participants