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 Presets: Unexpected scroll to color presets when selecting a style variation #61841

Open
andrewserong opened this issue May 22, 2024 · 7 comments
Labels
[Feature] Theme Style Variations Related to style variations provided by block themes Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Type] Bug An existing feature does not function as intended

Comments

@andrewserong
Copy link
Contributor

Description

Related to #61213 and possibly introduced in #61334

While testing the new color presets in trunk, I noticed that if you select one of the color presets and then go to select a style variation, the first time you click the style variation, the site editor's browse mode side bar unexpectedly scrolls down to the already selected color preset.

Step-by-step reproduction instructions

  1. Open the site editor
  2. In the left hand sidebar of the browse mode, navigate to Styles
  3. Scroll down and select one of the color presets
  4. Then, scroll up and click on one of the style variations
  5. Notice that the sidebar scrolls down to the already selected color preset, instead of focus being placed on the style variation that the user clicked on
  6. If you then attempt to click on the style variation a second time, it works as expected

Screenshots, screen recording, code snippet

2024-05-21.18.44.54.mp4

Environment info

  • WP 6.5.3
  • Gutenberg trunk
  • macOS
  • Google Chrome

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

@andrewserong andrewserong added [Type] Bug An existing feature does not function as intended [Feature] Theme Style Variations Related to style variations provided by block themes Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json labels May 22, 2024
@amitraj2203
Copy link
Contributor

Hi @andrewserong, I think the bug mentioned in the issue is fixed in this PR. I also tried to replicate it but couldn't. Let me know if I'm missing anything.

@andrewserong
Copy link
Contributor Author

Thanks @amitraj2203, but after re-testing trunk after #61617, this issue still appears to be present:

2024-05-27.14.49.52.mp4

In case it helps, I found it easier to reproduce on a smaller window size, e.g. a 13" laptop screen, where the Styles sidebar scrolls quite a long way. On larger screen sizes where both the style variations and color palettes are visible at the same time, the scroll issue doesn't appear to occur (I suspect because the elements are all visible?), so it's just when the other components aren't visible where the unexpected scroll seems to be happening.

@richtabor
Copy link
Member

I'm pretty sure this existed before #61334. Let's target a fix for 6.6.

@Sourav61
Copy link
Contributor

Sourav61 commented Jul 2, 2024

Hey @andrewserong, I tested the above issue and can reproduce this issue But I wanted to confirm whether the scroll on changing the style variation is expected or not.

I think that updating the style variation should automatically scroll to the colour palette associated as the next step so that we can confirm the colour palette and typography to be used

I will be working on the fix for the focus not being placed correctly on the style variation that the user clicked on.

@andrewserong
Copy link
Contributor Author

Thanks for the ping!

But I wanted to confirm whether the scroll on changing the style variation is expected or not.

I believe the scroll is unexpected. In this case we can't know whether a user wishes to continue toggling through the style variations, so to me it would be unexpected to be scrolled immediately to another part of the UI as these screens aren't explicitly step based.

@scruffian
Copy link
Contributor

I can no longer reproduce this, can you @andrewserong ?

@andrewserong
Copy link
Contributor Author

Thanks for the ping! I can still reproduce this @scruffian. It can be a little tricky to reproduce if your theme only has a couple of presets as the issue only occurs when there's enough style variations and palettes that the buttons are out of view. To reproduce / emulate a theme that has a lot of presets, I've reduced my browser window down so that it's very short. I'm testing on Chrome on macOS. Here's how it's looking for me:

Gutenberg trunk

2024-07-10.10.12.34.mp4

WP 6.6 RC 3 (without Gutenberg)

2024-07-10.10.11.57.mp4

In the above screengrabs, I select a style variation, then click the color palette and then it snaps back up to the style variation. But it also happens the other way around for me if I select a color palette first and then go to select a variation, it'll snap down to the color palette.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Theme Style Variations Related to style variations provided by block themes Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Type] Bug An existing feature does not function as intended
5 participants