Borders: Deleting the value should delete the border
What problem does this address?
I'm having a border, but then I want it only to be on top. So, I'm deleting all the values, but nothing visually changes. I'm getting confused, especially because when changing the view, it says "mixed" values - so it seems to took my change but I can't see anything new?! I am entering 0 as a value, which automatically deletes also the color. This is frustrating, I only wanted to see how it looks like without a right and bottom border. When going back, I have to select the color again…
There are some things to highlight that makes this process unintuitive:
- The interface says "Mixed" but the visuals are identical
- The user must know that they have to put "0" in the field
- The software doesn't remember what previous color was selected (The average users will for sure also not)
https://github.com/WordPress/gutenberg/assets/17861443/136d867b-b4ca-49f9-b337-2a59a965b008
Thanks , for sharing the issue, while i was reproducing the issue i noticed another strange behavior, like if we clear values of border then it correctly reflects in Editor but when we visit frontend its not reflecting the changes which is causing mismatch between appearance of Editor and Frontend.
For example i have set border then if i remove values of left,right and botttom border then it correctly reflects in Editor but in frontend we can see all 4 borders are still applied.
Screencast
https://github.com/user-attachments/assets/85ff3141-17da-4388-90ae-51c21324e44b
I am entering 0 as a value, which automatically deletes also the color. This is frustrating, I only wanted to see how it looks like without a right and bottom border. When going back, I have to select the color again…
For above mentioned concern i have debugged and found out that this behaviour kept intentional like if user selects width value as 0 then color is also being removed.
See the relevant code below which shows removal of color when width set to zero is intentional. So this issue needs design discussion as it is deliberate UX decision
https://github.com/WordPress/gutenberg/blob/61d35251d6b3594ed48d0924818fec7f6db48a6f/packages/components/src/border-control/border-control/hook.ts#L89-L99
For that test case is also written which you can find below.
https://github.com/WordPress/gutenberg/blob/6d3b7956302647536bc1f19fc23bce7c8d8be0c1/packages/components/src/border-control/test/index.js#L400-L417