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

feat: grid-pro loading editor state #8156

Merged
merged 2 commits into from
Nov 18, 2024

Conversation

tomivirkki
Copy link
Member

@tomivirkki tomivirkki commented Nov 14, 2024

Description

To resolve #2550, add support to vaadin-grid-pro for loading-editor attribute, which disables keyboard interaction on the focused cell and styles it with a pulsating outline. Also, content of the cell is hidden (using opacity) and pointer events are prevented on it.

The following recording uses the Flow GridPro component with network throttling on.

Kapture.2024-11-14.at.16.49.01.mp4

Related vaadin/flow-components#6820

The feature is not intended for public use so it's not documented nor exposed as a property.

Part of #2550

Type of change

Feature

Comment on lines 50 to 69
/* Loading editor cell styles are used by Flow GridPro */
:host([loading-editor]) [part~='focused-cell']::before {
content: '';
position: absolute;
inset: 0;
pointer-events: none;
box-shadow: inset 0 0 0 var(--_focus-ring-width) transparent;
animation: vaadin-grid-pro-loading-editor 1.4s infinite;
}

:host([loading-editor]) [part~='focused-cell'] ::slotted(vaadin-grid-cell-content) {
opacity: 0;
pointer-events: none;
}

@keyframes vaadin-grid-pro-loading-editor {
50% {
box-shadow: inset 0 0 0 var(--_focus-ring-width) var(--_focus-ring-color);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we going to add styles for the Material theme as well?

I wonder if the part that sets the opacity and pointer-events should be moved to the core styles of the component.

Copy link
Member Author

Choose a reason for hiding this comment

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

The plan is to not add Material theme for "loading-editor"

Copy link
Member

Choose a reason for hiding this comment

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

I think at least pointer-events could be in the core styles since this is covered by unit test.

Copy link
Member Author

Choose a reason for hiding this comment

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

I wonder if the part that sets the opacity and pointer-events should be moved to the core styles of the component.

Probably still makes sense to move opacity and pointer-events to core styles. Done.

@tomivirkki tomivirkki force-pushed the feat/grid-pro-loading-editor-cell-styles branch from c64cd19 to 67e3959 Compare November 15, 2024 09:43
Copy link

sonarcloud bot commented Nov 15, 2024

@tomivirkki tomivirkki merged commit 6ef77b9 into main Nov 18, 2024
9 checks passed
@tomivirkki tomivirkki deleted the feat/grid-pro-loading-editor-cell-styles branch November 18, 2024 10:34
vaadin-bot pushed a commit that referenced this pull request Nov 18, 2024
@vaadin-bot
Copy link
Collaborator

Hi @tomivirkki and @tomivirkki, when i performed cherry-pick to this commit to 24.4, i have encountered the following issue. Can you take a look and pick it manually?
Error Message:
Error: Command failed: git cherry-pick 6ef77b9
error: could not apply 6ef77b9... feat: grid-pro loading editor state (#8156)
hint: After resolving the conflicts, mark them with
hint: "git add/rm ", then run
hint: "git cherry-pick --continue".
hint: You can instead skip this commit with "git cherry-pick --skip".
hint: To abort and get back to the state before "git cherry-pick",
hint: run "git cherry-pick --abort".

@vaadin-bot
Copy link
Collaborator

Hi @tomivirkki and @tomivirkki, when i performed cherry-pick to this commit to 24.3, i have encountered the following issue. Can you take a look and pick it manually?
Error Message:
Error: Command failed: git cherry-pick 6ef77b9
error: could not apply 6ef77b9... feat: grid-pro loading editor state (#8156)
hint: After resolving the conflicts, mark them with
hint: "git add/rm ", then run
hint: "git cherry-pick --continue".
hint: You can instead skip this commit with "git cherry-pick --skip".
hint: To abort and get back to the state before "git cherry-pick",
hint: run "git cherry-pick --abort".

@vaadin-bot
Copy link
Collaborator

This ticket/PR has been released with Vaadin 24.6.0.alpha4 and is also targeting the upcoming stable 24.6.0 version.


@keyframes vaadin-grid-pro-loading-editor {
50% {
box-shadow: inset 0 0 0 var(--_focus-ring-width) var(--_focus-ring-color);
Copy link
Member

Choose a reason for hiding this comment

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

Animating opacity would be more performant. Animating the box-shadow requires a paint cycle, whereas opacity animation could be done purely by the GPU compositor.

Copy link
Member

Choose a reason for hiding this comment

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

Sorry for the late review. I’ll make a PR to update the animation.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

This approach was copied from date-picker Lumo styles:

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