Skip to content

LG-7080: Show in-person enrollment barcode on white background with padding#6731

Merged
aduth merged 17 commits intomainfrom
aduth-lg-7080-barcode-bg
Aug 16, 2022
Merged

LG-7080: Show in-person enrollment barcode on white background with padding#6731
aduth merged 17 commits intomainfrom
aduth-lg-7080-barcode-bg

Conversation

@aduth
Copy link
Contributor

@aduth aduth commented Aug 12, 2022

Why: So that it creates contrast to be legible on screens which apply default dark mode background color.

Preview: http://localhost:3000/rails/mailers/user_mailer/in_person_ready_to_verify

Review Notes:

Because the implementation impacts all barcode rendering, it would be a good idea to verify there are no regressions in other display (e.g. "You're ready to verify page"), particularly with previous issues (e.g. printing appearance).

Screenshot:

Before After
Screenshot_20220816-084440_Gmail Screenshot_20220816-084402_Gmail

@aduth aduth changed the title LG-7080: Show barcode on white background with padding LG-7080: Show in-person enrollment barcode on white background with padding Aug 12, 2022
@aduth
Copy link
Contributor Author

aduth commented Aug 12, 2022

Unfortunately the message still came through with an illegible barcode on my phone, so I'm gonna flip this back to draft while I take another pass at it.

@aduth aduth marked this pull request as draft August 12, 2022 15:38
@aduth
Copy link
Contributor Author

aduth commented Aug 12, 2022

Unfortunately the message still came through with an illegible barcode on my phone, so I'm gonna flip this back to draft while I take another pass at it.

Some additional resources:

My initial instinct is that we may be able to use the linear-gradient trick from the second link for Gmail, combined with @media (prefers-color-scheme: dark) for other email clients.

But these resources also have me wondering if #6732 could have an impact on the appearance, in case the revisions to use border-color could trigger auto-inverting coloring (a white barcode on black background would be just as effective a solution?).

Edit: Unfortunately, the border-color approach in #6732 didn't have any impact on the appearance in the email.

aduth added 3 commits August 15, 2022 09:12
**Why**: So that it creates contrast to be legible on screens which apply default dark mode background color.

changelog: Upcoming Features, In-person proofing, Improve legibility of barcodes on systems with dark mode theming
@aduth aduth force-pushed the aduth-lg-7080-barcode-bg branch from 75b905a to 7a66a40 Compare August 15, 2022 13:12
aduth added 11 commits August 15, 2022 10:22
Also limit to barcode image itself, since text color will likely invert, and that's okay as long as it's not white text on white background

_Maybe_ better luck with "background" property (vs. background-image), avoiding USWDS utility helpers, and using a separate element for the background
Some indication that Android Gmail may support this in dark mode https://webdesign.tutsplus.com/articles/fixing-problems-with-borders-in-dark-mode-email-design--cms-39410

(not viable as a complete solution, since ideally we'd not want to use the gray background except in contexts where it's required, i.e. dark mode)
Test to see how the white background is eliminated, maybe it will gracefully fall back to gray?
@aduth aduth marked this pull request as ready for review August 16, 2022 12:46
@aduth aduth requested review from a team, NavaTim and x341x and removed request for a team and x341x August 16, 2022 12:46
Copy link
Contributor

@sheldon-b sheldon-b left a comment

Choose a reason for hiding this comment

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

Nice!

@aduth
Copy link
Contributor Author

aduth commented Aug 16, 2022

Unfortunately the message still came through with an illegible barcode on my phone, so I'm gonna flip this back to draft while I take another pass at it.

To summarize the revisions: I made several attempts to try to force email clients to render with the white background (or to at least to invert the barcode lines to white on dark background) with limited success.

In the end, the solution I landed on was to revert back to using an image like we did in the initial implementation in #6580. Per discussion at #6580 (comment) , this was changed to the HTML outputter in #6585 to try to improve compatibility with email content. The original issue with using an image was based on how we tried to render the image with data URIs, which are not supported by email clients. This is addressed here by attaching the image data to the email and referencing that image instead of using the data URI, while still using data URIs in the web view.

@tomas-nava
Copy link
Contributor

Because the implementation impacts all barcode rendering, it would be a good idea to verify there are no regressions in other display (e.g. "You're ready to verify page"), particularly with previous issues (e.g. printing appearance).

I checked the ready to verify page and email, including printing, and verifying that the barcodes read as expected and found no regressions.

@aduth aduth merged commit a0e3c56 into main Aug 16, 2022
@aduth aduth deleted the aduth-lg-7080-barcode-bg branch August 16, 2022 16:28
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.

4 participants