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

refactor!: use checkmark icon for checked state #3297

Merged
merged 4 commits into from
Jan 24, 2022

Conversation

web-padawan
Copy link
Member

Description

As reported in #3262 we have a problem of checkmark looking incorrect when changing font size on the checkbox.
We could fix this by replacing em with calculated / hardcoded values as mentioned in #3262 (comment)

However, while looking into this, I realised that --lumo-icons-checkmark might be a better alternative:

  1. Using icon does not require any calculations such as width: calc(var(--lumo-size-s) / 3);
  2. The icon looks quite similar to the current checkmark (there is a difference, but not significant).
  3. It's easier to provide a custom checkmark: no need to tweak borders, just replace the ✔️ icon

Fixes #959
Fixes #3262

Type of change

  • Breaking change

@web-padawan web-padawan force-pushed the refactor/lumo-checkmark branch 2 times, most recently from 7901976 to b8e6d69 Compare January 17, 2022 09:45
Copy link
Member

@jouni jouni left a comment

Choose a reason for hiding this comment

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

Use the icon size prop. Center the icon within the checkmark container.

packages/checkbox/theme/lumo/vaadin-checkbox-styles.js Outdated Show resolved Hide resolved
@tomivirkki
Copy link
Member

The checkmark of the rightmost checkbox in the updated value.png looks slightly misaligned (too much on the right):
Screenshot 2022-01-17 at 12 29 09

@jouni
Copy link
Member

jouni commented Jan 17, 2022

Yeah, I noticed that too, and it seems that unfortunately Chrome suffers from sub-pixel misalignment issues here, that are caused by the previous elements in the DOM. Changing the text content of the labels affects the position of the icon. I’m not sure what would be a good workaround/fix to that. Maybe contain: layout?

I didn't notice this issue in Safari or Firefox.

Update: [part='checkbox']::after { contain: content; } looks like a suitable fix.

Co-authored-by: Jouni Koivuviita <jouni@vaadin.com>
Cleanup leftover transitions
@sonarcloud
Copy link

sonarcloud bot commented Jan 19, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Copy link
Member

@tomivirkki tomivirkki left a comment

Choose a reason for hiding this comment

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

Other than the border-radius issue, lgtm

(Also the nice check animation is gone 😢 )
checkbox-animation

@web-padawan web-padawan removed the request for review from jouni January 24, 2022 12:01
@web-padawan web-padawan merged commit 5082d60 into master Jan 24, 2022
@web-padawan web-padawan deleted the refactor/lumo-checkmark branch January 24, 2022 12:02
@vaadin-bot
Copy link
Collaborator

This ticket/PR has been released with platform 23.0.0.alpha4 and is also targeting the upcoming stable 23.0.0 version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[vaadin-checkbox] Ugly check mark when changing font size [checkbox] Refactor Lumo styles for the checkmark
4 participants