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

Color picker handle issues #49267

Closed
jameskoster opened this issue Mar 22, 2023 · 6 comments · Fixed by #55149
Closed

Color picker handle issues #49267

jameskoster opened this issue Mar 22, 2023 · 6 comments · Fixed by #55149
Assignees
Labels
[Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi [Package] Components /packages/components [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@jameskoster
Copy link
Contributor

Description

color.picker.handle.mp4

Visually: it's strange that the handle is clipped when it's close to the edge of the picker.

Behaviourally: when the cursor is outside the picker the handle stops moving, and eventually seems to close the entire picker for no reason.

Step-by-step reproduction instructions

  1. Open a color picker and observe the clipped handle when it's close to an edge
  2. Drag the handle and move the cursor outside of the picker container, notice that the handle stops moving.

Screenshots, screen recording, code snippet

No response

Environment info

Gutenberg trunk
WordPress 6.2

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@jameskoster jameskoster added the [Type] Bug An existing feature does not function as intended label Mar 22, 2023
@hanneslsm
Copy link

hanneslsm commented Mar 22, 2023

Linking for visibility another issue with the color picker by moving the cursor outside the container. Don't know if this is related though. #47504

@mtias mtias added the [Package] Components /packages/components label May 1, 2023
@vcanales vcanales self-assigned this May 18, 2023
@jameskoster jameskoster added the [Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi label Aug 2, 2023
@ciampo
Copy link
Contributor

ciampo commented Sep 1, 2023

Could you specificy better what is the expected behaviour?

Also note that the color picker is internally using the react-colorful library, and therefore it may be tricky to change some aspects of the picker.

@jameskoster
Copy link
Contributor Author

Sure.

Currently the handle gets clipped like this:

clipped

Ideally it remains visible:

unclipped


When dragging the handle, if the cursor exits the container then control is lost. Ideally the user shouldn't have to keep their cursor strictly inside .react-colorful__interactive while dragging. Here's how it works in Figma which is what we're aiming for:

handle.mp4

@ciampo
Copy link
Contributor

ciampo commented Sep 1, 2023

Thank you!

Ideally it remains visible

I believe that's something related to how we assign overflow: hidden to the color picker popover, I'll see if we can do anything about it.

When dragging the handle, if the cursor exits the container then control is lost

Now I see what you mean. My suspicion is that the reason why the cursor doesn't move is because of the block editor canvas being embedded in a iframe. The iframe would capture the pointer events, and would therefore prevent those events from moving the handle.

Out of curiosity, I tried interacting with the storybook example: as you can see, as far as the cursor stays within the Storybook demo canvas, the drag handle moves as expected. But as soon as my cursor hovers over the Storybook toolbar and sidebar (which are outside of the Storybook canvas' iframe), the drag handle stops following the cursor.

color-picker-drag.mp4

@jameskoster
Copy link
Contributor Author

Oh good catch. I guess that's going to make it quite tricky to fix?

@ciampo
Copy link
Contributor

ciampo commented Sep 4, 2023

The iframe could indeed complicate things, although it looks like the main culript is a combination of overflow CSS rules that comes into play when the ColorPicker component is rendered inside a Popover.

Trying an approach in #54164

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi [Package] Components /packages/components [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
Status: Done
5 participants