Skip to content

refactor!: use checkmark icon for checked state - #3297

Merged
web-padawan merged 4 commits into
masterfrom
refactor/lumo-checkmark
Jan 24, 2022
Merged

web-padawan merged 4 commits into
masterfrom
refactor/lumo-checkmark

Conversation

@web-padawan

Copy link
Copy Markdown
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 requested a review from jouni January 17, 2022 09:41
@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
@web-padawan
web-padawan force-pushed the refactor/lumo-checkmark branch from b8e6d69 to ada5ae3 Compare January 17, 2022 09:46

@jouni jouni left a comment

Copy link
Copy Markdown
Member

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.

@tomivirkki

Copy link
Copy Markdown
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

jouni commented Jan 17, 2022 •

Copy link
Copy Markdown
Member

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.

@web-padawan
web-padawan requested a review from jouni January 17, 2022 10:44
Co-authored-by: Jouni Koivuviita <jouni@vaadin.com>
@web-padawan
web-padawan requested a review from jouni January 17, 2022 11:23
Cleanup leftover transitions
@sonarqubecloud

Copy link
Copy Markdown

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

@tomivirkki tomivirkki left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
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