-
Notifications
You must be signed in to change notification settings - Fork 150
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
LG-3427: Size desktop selfie capture aligned to ID inputs in review step #4260
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about the implementation notes, but screenshot looks good 👍
Two favors: 1) check that mobile is unaffected (should span full width minus L/R margin), and 2) check that the live camera capture is still larger when user clicks retake photo? Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
onChange={(nextSelfie) => onChange({ selfie: nextSelfie })} | ||
errorMessage={selfieError ? <FormErrorMessage error={selfieError} /> : undefined} | ||
/> | ||
<div style={{ maxWidth: '375px' }}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inline styles on a wrapper element is not an ideal implementation here, though it seemed more appealing than one of the obvious alternatives:
- BEM modifier class
selfie-capture--size-as-id-input
, applied either via propclassName
orisSizedAsIdInput
prop onSelfieCapture
.SelfieCapture
supportsstyle
prop, applying inline style instead of wrapper element.
Instead of BEM style, could we just define something like .image-input
? and apply that to all 3 input fields? Then it would have the max-width
bit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the style attribute will be allowed by the CSP. This would need to be nonced in order to work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the style attribute will be allowed by the CSP. This would need to be nonced in order to work.
Hm, I was a bit confused by this, since we have inline styles elsewhere already, notably in the AcuantCaptureCanvas
component, which appear to work just fine.
I dug into this a bit more, and it appears that it's possibly fine because of how React is actually assigning these styles using the style property.
Related: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/style-src
However, styles properties that are set directly on the element's style property will not be blocked, allowing users to safely manipulate styles via JavaScript:
document.querySelector('div').style.display = 'none';
That being said, I like @zachmargolis's suggestion of a class here anyways, so I'll plan to move away from the inline styles here. It might be worth considering for AcuantCaptureCanvas
as well, just to avoid any potential future conflicts with CSP (including possible changes in the spec and/or browser behavior).
Pulling out the discussion from #4260 (comment) : Part of the reason I've leaned on inline styles is that it's not entirely obvious the best place to put stylesheets for some of these domain-specific components (e.g. components under the umbrella of "document capture"). In bc93ce4d01c6e403e744bcee997c69289793fd95, I consider allowing stylesheets to be defined adjacent to the component JavaScript, based partly on some guidance from Webpacker documentation. I think this could work well as a pattern for defining styles for individual components, but there's a few considerations:
I'm not set on this approach, so any concerns are welcomed! |
Thanks for looking!
The width constraint is applied as a iPhone X Screenshot Example: localhost_3000_verify_doc_auth_document_capture(iPhone X)
This should be updated in 24d8596.
|
Great thanks for confirming both that it's |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -6,6 +6,7 @@ import AcuantCapture from './acuant-capture'; | |||
import SelfieCapture from './selfie-capture'; | |||
import FormErrorMessage from './form-error-message'; | |||
import ServiceProviderContext from '../context/service-provider'; | |||
import './review-issues-step.scss'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't realize JS could import CSS files? 🤯
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't realize JS could import CSS files? 🤯
Not JS, but Webpack. It can feel like a bit of an ugly hack, but it's nice to keep things self-contained, and leaves open some options for omitting unused styles.
The main alternative here could be to have something like a manifest file or SASS entrypoint which then loads all of the individual stylesheets for the package.
As you noticed below, this is a feature Webpacker provides for free by providing an option to extract CSS imported this way.
Related:
**Why**: Per design, for consistent width of inputs on Review Issues step.
**Why**: Errors if plugins provided, warns if plugins not provided. Not intending to use any plugins. Wasted overhead to run loader when unused.
24d8596
to
41148af
Compare
See: 18F/identity-idp#5359 **Why:** So that we can use a common standard ruleset across all repositories where JavaScript is used. Notes: - Doesn't yet incorporate Prettier, since that will be a significant number of changes that can be safely be applied separately. - Removes PostCSS configuration. This follows a [similar removal in IdP](18F/identity-idp#4260), and we don't appear to be using [import inlining](https://github.com/postcss/postcss-import). Flexbugs and env settings seem most applicable to legacy browsers like Internet Explorer, but we appear to already be targeting newer browsers with e.g. [unpolyfilled usage of modern JavaScript like String#includes](https://github.com/18F/identity-dashboard/blob/abb55d8efa906f3db62ffa93f02b2d52e1bfacad/app/javascript/app/service-provider-form.js#L76).A quick check in Internet Explorer does not reveal any obvious breakage where we depend on these transforms.
See: 18F/identity-idp#5359 **Why:** So that we can use a common standard ruleset across all repositories where JavaScript is used. Notes: - Doesn't yet incorporate Prettier, since that will be a significant number of changes that can be safely be applied separately. - Removes PostCSS configuration. This follows a [similar removal in IdP](18F/identity-idp#4260), and we don't appear to be using [import inlining](https://github.com/postcss/postcss-import). Flexbugs and env settings seem most applicable to legacy browsers like Internet Explorer, but we appear to already be targeting newer browsers with e.g. [unpolyfilled usage of modern JavaScript like String#includes](https://github.com/18F/identity-dashboard/blob/abb55d8efa906f3db62ffa93f02b2d52e1bfacad/app/javascript/app/service-provider-form.js#L76).A quick check in Internet Explorer does not reveal any obvious breakage where we depend on these transforms.
Why: Per design, for consistent width of inputs on Review Issues step.
Implementation Notes:
Inline styles on a wrapper element is not an ideal implementation here, though it seemed more appealing than one of the obvious alternatives:
selfie-capture--size-as-id-input
, applied either via propclassName
orisSizedAsIdInput
prop onSelfieCapture
.SelfieCapture
supportsstyle
prop, applying inline style instead of wrapper element.Problem in both of these is that this requirement feels very use-case specific to bake into
SelfieCapture
.