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

chore: use checkbox component #6023

Merged
merged 1 commit into from
May 10, 2024
Merged

chore: use checkbox component #6023

merged 1 commit into from
May 10, 2024

Conversation

deboer-tim
Copy link
Collaborator

What does this PR do?

I noticed several places where we're using a standard blue instead of our styled Checkbox.

Run Image is the biggest one, just requires the ability to set a class on Checkbox for spacing.

Screenshot / video of UI

Before:
Screenshot 2024-02-15 at 10 12 43 AM

After:
Screenshot 2024-02-15 at 10 33 30 AM

What issues does this PR fix or reference?

N/A

How to test this PR?

Unit tests still work; page through Run Image form to confirm styling.

@deboer-tim deboer-tim requested review from benoitf and a team as code owners February 15, 2024 15:48
@deboer-tim deboer-tim requested review from axel7083 and lstocchi and removed request for a team February 15, 2024 15:48
Copy link
Contributor

@lstocchi lstocchi left a comment

Choose a reason for hiding this comment

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

LGTM

@cdrage cdrage enabled auto-merge (squash) February 21, 2024 13:40
@deboer-tim
Copy link
Collaborator Author

@odockal helped investigate. Although for humans and vitest it's fine, the E2E tests are unable to click a Checkbox because it's a native sr-only checkbox underneath a FA SVG - to playwright, there is always something hiding the real checkbox. We will likely have to rewrite the Checkbox to avoid this.

@odockal
Copy link
Contributor

odockal commented Feb 26, 2024

@deboer-tim A workaround could be in this case, to use parent element (div) that has a label for specific checkbox, so we can get the element with page.getByLabel('CheckBox name') and make the test pass again. Although, anyone writing the test trying to handle the checkbox will be facing the same issue over and over, so proper handling as rewrite the checkbox seems like viable solution.

@benoitf benoitf marked this pull request as draft March 12, 2024 17:46
auto-merge was automatically disabled March 12, 2024 17:46

Pull request was converted to draft

@benoitf
Copy link
Collaborator

benoitf commented Mar 12, 2024

converting to draft

I noticed several places where we're using a standard blue <input
type="checkbox" /> instead of our styled Checkbox. Run Image is the
biggest user.

This change originally caused failures in the E2E tests because our
Checkbox was incompatible with Playwright, since the input in this
checkbox component was neither visible nor Aria compliant.

I wasted lots of time earlier this year trying to build a custom
checkbox that was aria-compliant, but the fix was much simpler after
carefully reading the Playwright requirements here:
https://playwright.dev/docs/actionability#visible

The input checkbox cannot be hidden or 0 size, and cannot be 'behind'
the div icon. However, it can be opacity-0 and on top using absolute
positioning and changing the z-order by swapping the order of elements.

Signed-off-by: Tim deBoer <git@tdeboer.ca>
@deboer-tim
Copy link
Collaborator Author

Rebased with changes to checkbox, moving back to ready for review. @benoitf, @lstocchi (or others) please take another look or re-confirm your approval by merging. Thanks to @odockal for his help.

This change originally caused failures in the E2E tests because our Checkbox was incompatible with Playwright, since the input in this checkbox component was neither visible nor Aria compliant. I wasted lots of time trying to build a custom checkbox that was aria-compliant, but the fix was much simpler after carefully reading the Playwright requirements here: https://playwright.dev/docs/actionability#visible

The input checkbox cannot be hidden or 0 size, and cannot be 'behind' the div icon. However, it can be opacity-0 and on top using absolute positioning and changing the z-order by swapping the order of elements.

@deboer-tim deboer-tim marked this pull request as ready for review May 9, 2024 15:35
Copy link
Contributor

@lstocchi lstocchi left a comment

Choose a reason for hiding this comment

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

Tested and works fine. LGTM!!

@deboer-tim
Copy link
Collaborator Author

@benoitf are you ok to merge?

@benoitf
Copy link
Collaborator

benoitf commented May 10, 2024

yes

@deboer-tim deboer-tim merged commit 1517483 into main May 10, 2024
8 checks passed
@deboer-tim deboer-tim deleted the checkboxes branch May 10, 2024 15:22
@podman-desktop-bot podman-desktop-bot added this to the 1.11.0 milestone May 10, 2024
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.

None yet

5 participants