Skip to content

fix(ui5-color-picker): keep pointer aligned at any root font-size#13563

Open
hinzzx wants to merge 1 commit into
mainfrom
cp-root-font-fix
Open

fix(ui5-color-picker): keep pointer aligned at any root font-size#13563
hinzzx wants to merge 1 commit into
mainfrom
cp-root-font-fix

Conversation

@hinzzx
Copy link
Copy Markdown
Contributor

@hinzzx hinzzx commented May 20, 2026

Overview

When the HTML root font-size was anything other than 16px, the ColorPicker's draggable circle drifted outside the saturation/lightness box and the picked color value became incorrect (e.g. the bottom-right corner no longer produced #ffffff). The picker box is sized in rem, but the JS positioning math hardcoded 256 pixels (= 16rem at 16px root), so the two went out of sync at any other root font-size.

Fixes #13521.

What We Did

  • Rewrote how the marker circle is placed inside the color square so it always lines up with where the user clicks, no matter the website's text size
  • Verified the fix works the same way across every available theme (light, dark, high-contrast variants) and in both regular and compact display modes
  • Added automated tests that re-create the original problem and confirm it stays fixed in the future
  • Improved the developer playground page so it's easy to try the Color Picker at different text sizes, themes, and display modes

What This Fixes

  • Reliable color selection - the chosen color now always matches what the user clicked, on any website
  • Works everywhere - the fix works the same in every theme and display mode the library supports

Before

2026-05-20_15-17-47 (1)

After

2026-05-20_15-08-20 (1)

@ui5-webcomponents-bot
Copy link
Copy Markdown
Collaborator

@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview May 20, 2026 12:33 Inactive
@didip1000 didip1000 self-requested a review May 20, 2026 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ColorPicker]: Picker is not working properly when html font-size is not 16px

2 participants