-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
normalizeColorOptions
in TablePropertiesUI breaks UX of ColorInputData
#6791
Comments
@Reinmar & @tomalec there's no "Dim Grey" color in CSS specs :wink: . All CSS color keywords are single word. So basically "Dim grey" should be treated as an error IMO. Additionally the Firefox & Chrome do not support such values (I've checked if maybe they normalize it somehow): ps.: The ckeditor5/packages/ckeditor5-engine/src/view/styles/utils.js Lines 16 to 43 in e62c918
|
@jodator That's not the point. We of course know that "Dim grey" is not a CSS value. The problem is that some algorithms in the editor work on a normalized CSS color values (with deletes spaces). And some don't. There's a mess now and it leads to the bug reported by @tomalec. We're setting the same color in two inputs and after opening the balloon again it's loaded back in just on of them. WTH, right? So we tried to debug this and we found out that at one point all spaces are stripped from CSS color values. Why is UI's component ColorGrid stripping spaces from values of colors that were passed to it is a mystery to me. The UI should be about displaying the UI, not doing some unnecessary tricks for apparently no reason. My proposal is to:
|
Oh OK - sorry, I was a bit anchored by the value name and mapped it to a CSS values. I see the problem now. The proposal make sense. Hopefully no one will try to use |
To clarify on "Dim grey". ckeditor5/packages/ckeditor5-table/src/ui/utils.js Lines 347 to 355 in 3c7c28d
What I was referring to, is that this exact feature is bugged due to OP. |
Fix (table): When the state is restored or the user enters color value manually, color input is able to provide a matching color label. Closes #6791.
📝 Provide detailed reproduction steps (if any)
This issue was discovered during the review of #6784
editor.setData(editor.getData())
in the browser console.✔️ Expected result
"Dim grey" should be shown in both input boxes.
❌ Actual result
Border color input shows actual color value: "hsl(0, 0%, 30%)".
📃 Other details
After a brief investigation with @Reinmar we discovered that removing
.replace( / /g, '' )
ckeditor5/packages/ckeditor5-ui/src/colorgrid/utils.js
Lines 73 to 85 in 3c7c28d
Solves the problem.
There is a mismatch between normalized and non-normalized values set by the element, and set by the state restore.
We were not sure why this normalization was there, and what side effect we might introduce by removing it. However, it seems to me that we should use, preserve, and accept values in exactly the same shape as they were given in the initial config.
If you'd like to see this fixed sooner, add a 👍 reaction to this post.
The text was updated successfully, but these errors were encountered: