-
Notifications
You must be signed in to change notification settings - Fork 331
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
feat: security banner concept #9780
Conversation
For QA, we may have a spot or 2 in the app that calculates coordinates assuming a banner doesn't exist, e.g. remotely dragged reflections & oauth popup windows. Chances are any calculation that adds a hardcoded number to |
Good to know @mattkrick — if I set a height to the banner, can we add or subtract that amount to the |
I think it'll just be a case-by-case basis, if thing look good with the banner, we're good! |
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.
it looks good! the only downfall is that this adds quite a bit of complexity to our whole app. before merging, can we make sure that there's no simpler way to do this? I think we could probably keep the logic constrained to the parent <Action/>
component
return ( | ||
<div className='flex h-full w-full flex-col bg-white'> | ||
<div className='flex grow'> | ||
<div className='mt-4 w-full grow'> | ||
<div className={clsx('mt-4 w-full grow', isGlobalBannerEnabled && 'pt-6')}> |
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.
-1 as we build out our app, it'd be pretty easy to forget to include this logic! Instead of making sure this is included in every child component, could we just keep it in <Action/>
? We can wrap the <Switch/>
with <div className={isGlobalBannerEnabled ? 'pt-6' : ''}>
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.
Maybe, I can try this and see if layout breaks.
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.
The problem is we have some components that use 100vh
so we’d probably at least have to touch those. I can see about reducing the scope to <Action />
and any components using 100vh
devTemplate.html
Outdated
@@ -1,4 +1,4 @@ | |||
<!DOCTYPE html> | |||
<!doctype html> |
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.
This was due to auto-formatting
@mattkrick I added a wrapper around the
|
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.
Ready for additional review and testing!
I noticed if the env var does not exist then the banner still appears with no text. I think the banner should not appear unless the env var is explicitly set |
Testing logic changes and smoke tested the views. LGTM! @mattkrick if things look ok to you let's ship it |
path={`/forgot-password`} | ||
render={(p) => <AuthenticationPage {...p} page={'forgot-password'} />} | ||
/> | ||
<div className='flex h-full max-h-screen flex-col'> |
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.
in testing, i deleted this div & everything still worked OK, is there a use case where this is required?
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.
This one allows for better control of the main height by wrapping both the banner and the main view. I think there may be one other way I could try. Let me test.
{/* Set up a container for the global banner and the main app area */} | ||
<div | ||
className={clsx( | ||
'h-100 flex flex-1 flex-col overflow-hidden', |
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.
can we get rid of everything here except the pt-6
? having overflow-hidden as a parent could make things difficult because that means no component will be able to use the viewport scroll
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 think it was hard to control height of inner components on all the main views. In other words, I can do it on this one view and then tweak a few things here in there, or I have to go to most of the main views and adjust heights and what not. I’m not sure how much that would have to be conditional based on the GLOBAL_BANNER_ENABLED
which I was trying to use less. So much of the app has to control inner scrolling. Maybe only mobile is relying on true viewport scrolling?
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’ve got something I want to try but I think we should consider moving forward and making an additional set of improvements in a later PR.
Trying to remove those new outermost containers, I run into the same problems I fixed with them, go figure. I’m not sure how to get containers to behave. We have many, many containers where we are controlling the scrolling, and we have many views that layout to fit the viewport with inner scrolling. Introducing a global banner affects all views. Not sure if or how long it will take to try to find a way to achieve the tight views without odd scrolling etc due to the banner. We could ship this as it is timely, and then maybe clean up the container later. I’ll see if I can get somewhere with another approach that plays nice with all views, but until then I think it’s shippable. Good over perfect. |
@mattkrick thanks for reviewing, do I merge now or do you or @Dschoordsch have to merge? |
Concept
Adds a banner with color and message options. Fixes #9778
Demo
Loom 1 of 3 — Proof of Concept
Loom 2 of 3 — Fixed Banner in All App Views
Loom 3 of 3 — Layout Accounts for Banner
Todo
Test
.env
variables including options for text, text color, and background colors/invitation-link/12345678
view