Skip to content

uui-color: add better support for touch screens #532

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

Conversation

iOvergaard
Copy link
Contributor

Description

Fixes #509

Update the move() function to handle TouchEvent as well as PointerEvent. When initially "clicking" on a touch screen, it will pass a TouchEvent that does not match the signature of a PointerEvent, specifically it will not contain the pageX and pageY coordinates that the move() function expects. By analyzing the event with instanceof TouchEvent, we can pull out the .touches[0] object which is of type Touch and matches the signature of PointerEvent as far as we are concerned.

How to test

Spin up Storybook, go to either the uui-color-picker or uui-color-area stories and perform click, drag, and touch actions and see that it forwards a CHANGE event in the Actions tab. Specifically, the saturation and lightness properties of the srcElement should reflect what has happened, and visually the dot should have moved to where you clicked in the color area.

@iOvergaard iOvergaard added the bug Something isn't working label Jul 17, 2023
@iOvergaard iOvergaard requested a review from julczka July 17, 2023 13:11
@iOvergaard iOvergaard linked an issue Jul 17, 2023 that may be closed by this pull request
@iOvergaard
Copy link
Contributor Author

@bjarnef this should fix what you discovered in #509. Could I ask you for a review as well, please? ☺️

@github-actions
Copy link

Azure Static Web Apps: Your stage site is ready! Visit it here: https://delightful-beach-055ecb503-532.westeurope.azurestaticapps.net

1 similar comment
@github-actions
Copy link

Azure Static Web Apps: Your stage site is ready! Visit it here: https://delightful-beach-055ecb503-532.westeurope.azurestaticapps.net

@bjarnef
Copy link
Contributor

bjarnef commented Jul 17, 2023

Hi @iOvergaard from the generated Azure app it looks okay regarding the issue and in the color area dragging the handle is smooth.
However in inline color picker, it seems the handle is flickering while dragging, and dragging to bottom, the handle shortly jump to bottom left corner, which doesn't happen in the color area itself.

But it seems also to happen on uui.umbraco.com so probably another issue somewhere.

@iOvergaard
Copy link
Contributor Author

Hmm, I can't really reproduce that, @bjarnef, but happy to create a new issue to investigate further. Thanks for reviewing 👍

Copy link
Contributor

@julczka julczka left a comment

Choose a reason for hiding this comment

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

Works nicely on touch screeen. 👍🏻

@github-actions
Copy link

Azure Static Web Apps: Your stage site is ready! Visit it here: https://delightful-beach-055ecb503-532.westeurope.azurestaticapps.net

@github-actions
Copy link

Azure Static Web Apps: Your stage site is ready! Visit it here: https://delightful-beach-055ecb503-532.westeurope.azurestaticapps.net

@iOvergaard iOvergaard merged commit 2342f5a into v1/contrib Jul 18, 2023
@iOvergaard iOvergaard deleted the bugfix/509-changing-color-in-color-area-always-reset-hue-to-zero branch July 18, 2023 07:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Changing color in color area always reset hue to zero
3 participants