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(DataGrid): add checkbox support #5380

Merged
merged 18 commits into from
Jun 25, 2024

Conversation

AustinGitHub
Copy link
Contributor

@AustinGitHub AustinGitHub commented May 31, 2024

Closes #5302

Adds checkbox support

What did you change?

Adds checkbox support as an optional inline edit type.

Reason I made the PR is because NextGen DataStage needs this and doesn't seem there is much movement to get this implemented. Thanks!

How did you test and verify your work?

Verification

Screen.Recording.2024-05-30.at.5.11.01.PM.mov

I also validated that the data does get updated and set properly

see it isActive is set to true since it as checked

Screenshot 2024-05-30 at 5 10 56 PM

@AustinGitHub AustinGitHub requested a review from a team as a code owner May 31, 2024 00:15
@AustinGitHub AustinGitHub requested review from kennylam and sangeethababu9223 and removed request for a team May 31, 2024 00:15
Copy link

netlify bot commented May 31, 2024

Deploy Preview for carbon-for-ibm-products ready!

Name Link
🔨 Latest commit 8b055dd
🔍 Latest deploy log https://app.netlify.com/sites/carbon-for-ibm-products/deploys/6679851d9265c50008e15758
😎 Deploy Preview https://deploy-preview-5380--carbon-for-ibm-products.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@@ -485,7 +506,7 @@ export const InlineEditCell = ({
config?.validator?.(cellValue),
})}
>
{!inEditMode && (
{!inEditMode && type !== 'checkbox' && (
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because on UI checkbox will always be visible, so no need to do any enter to edit mode here

@AustinGitHub
Copy link
Contributor Author

Hi @kennylam and @sangeethababu9223 can you start the review process on this PR please? Thanks!

@matthewgallo
Copy link
Member

Hey @AustinGitHub, there are some spacing issues in the cell with the checkbox, also the active cell is not able to navigate to the cells with the checkbox in it like it's able to in all of the other cells.

@AustinGitHub
Copy link
Contributor Author

"there are some spacing issues in the cell with the checkbox"

How should the spacing be like?

"also the active cell is not able to navigate to the cells with the checkbox in it like it's able to in all of the other cells."

It shouldn't need to. The cell for the checkbox isn't like something that needs to be double clicked to activate and go into for the checkbox. It is not hidden behind the inline edit component. Otherwise we would need to double click for checkbox to work

@matthewgallo
Copy link
Member

matthewgallo commented Jun 4, 2024

The spacing should match the screenshot in #5302. My expectation would be that moving the active cell would focus the checkbox, otherwise you lose context for the location of the active cell. I think this could probably use some design input as well.

@AustinGitHub
Copy link
Contributor Author

Ok, I will fix the positioning

@AustinGitHub
Copy link
Contributor Author

Screenshot 2024-06-04 at 8 26 45 AM

Fixed the checkbox styling, will check on the edit behavior and see if I can look into it

@AustinGitHub
Copy link
Contributor Author

Screenshot 2024-06-04 at 8 33 42 AM

@matthewgallo I think the edit session is fine. I see these props

Screenshot 2024-06-04 at 8 34 25 AM

@matthewgallo
Copy link
Member

Yes, but it visually disappears from what I am seeing. I think it could be confusing to be navigating through the datagrid and suddenly the active cell disappears when you move to a checkbox cell, giving the checkbox focus could fix this. @jjennings7 do you have any thoughts on this interaction?

@AustinGitHub
Copy link
Contributor Author

I am not seeing this, can you provide video? Thanks!

Screen.Recording.2024-06-04.at.8.40.29.AM.mov

@matthewgallo
Copy link
Member

@AustinGitHub
Copy link
Contributor Author

Thanks, will take a look at this use case

fix: focus for the cell
@AustinGitHub
Copy link
Contributor Author

AustinGitHub commented Jun 4, 2024

Screen.Recording.2024-06-04.at.9.04.09.AM.mov

This is fixed in latest commit, let me resolve conflicts

Edit: Fixing some issues due to the conflicts, notice it isn't working anymore

@AustinGitHub
Copy link
Contributor Author

AustinGitHub commented Jun 4, 2024

It should be good now on the keyboard behavior

I went through and hit enter and escape to capture the behavior

Screen.Recording.2024-06-04.at.9.49.41.AM.mov

Copy link
Member

@sangeethababu9223 sangeethababu9223 left a comment

Choose a reason for hiding this comment

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

@AustinGitHub ,
There seems to be some mismatch with focus behaviour in PR preview story and the Production one.
Using Up / Down / Right / Left keys on the keyboard works as expected, but the behaviour with the tab key is not the same as the one in Production

@AustinGitHub
Copy link
Contributor Author

ok, I will check on tab behavior, thanks!

@AustinGitHub
Copy link
Contributor Author

AustinGitHub commented Jun 10, 2024

Hi @sangeethababu9223 I see production doesn't work properly for Tab either. I think that needs to be taken up in a separate issue

Screen.Recording.2024-06-10.at.8.19.22.AM.mov

Copy link
Member

@sangeethababu9223 sangeethababu9223 left a comment

Choose a reason for hiding this comment

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

Hi @AustinGitHub,
The focus behaviour in the production is as per w3 standards.
Please refer the link for details.
As per the above reference navigation inside the grid is done by up/down/left/right keys.

@AustinGitHub
Copy link
Contributor Author

Hi,
I am confused. So what is the issue with the focus behavior on mine compared to what is expected. Can you provide a video or some more info please?

Thanks!

@sangeethababu9223
Copy link
Member

Hi @AustinGitHub,
Please see the attached screen recordings:

Preview:

Screen.Recording.-.Preview.mov

Production:

Screen.Recording.-.Production.mov

Both preview and production works as expected while using up/down/left/right keys. The issue is while using tab key.

@AustinGitHub
Copy link
Contributor Author

ok, I will check

@AustinGitHub
Copy link
Contributor Author

AustinGitHub commented Jun 12, 2024

So is this the expected behavior then?

Screen.Recording.2024-06-11.at.10.27.57.PM.mov

Though, I am still confused on why the behavior is like this and why design is asking for the tab to be like that as I would figure the tab would want to go into the next cell rather than this weird column selection it is doing

@AustinGitHub
Copy link
Contributor Author

Hi, any update on this? Thanks!

@AustinGitHub
Copy link
Contributor Author

Conflicts are fixed

Copy link
Member

@sangeethababu9223 sangeethababu9223 left a comment

Choose a reason for hiding this comment

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

LGTM

@AustinGitHub
Copy link
Contributor Author

Thanks! @sangeethababu9223 can you remove the conflicts tag and add the pending one more review tag please? Thanks!

@matthewgallo matthewgallo added this pull request to the merge queue Jun 25, 2024
Merged via the queue into carbon-design-system:main with commit b1761a0 Jun 25, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Datagrids]: Add checkbox as a supported inlineEditType
3 participants