-
Notifications
You must be signed in to change notification settings - Fork 158
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
fix: Stacked notifications in compact mode and without content padding #775
Conversation
0f27dd9
to
b1783ba
Compare
Codecov ReportBase: 93.30% // Head: 93.30% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #775 +/- ##
=======================================
Coverage 93.30% 93.30%
=======================================
Files 584 584
Lines 17123 17129 +6
Branches 4722 4728 +6
=======================================
+ Hits 15976 15982 +6
Misses 1067 1067
Partials 80 80
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
2ee493c
to
2b7f98a
Compare
…BottomSpacing to work
576023e
to
c7b75bd
Compare
@@ -0,0 +1,155 @@ | |||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. |
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 recently added page app-layout/with-stacked-notifications-and-no-paddings
was deleted in favor of this one, which is more complete and makes it redundant. No tests had been written for the former yet.
@@ -112,7 +113,7 @@ export default function CollapsibleFlashbar({ items, ...restProps }: FlashbarPro | |||
const windowHeight = window.innerHeight; | |||
// Take the parent region into account if using the App Layout, because it might have additional margins. | |||
// Otherwise we use the Flashbar component for this calculation. | |||
const outerElement = flashbar.parentElement?.parentElement || flashbar; | |||
const outerElement = findUpUntil(flashbar, element => element.getAttribute('role') === 'region') || flashbar; |
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.
Made this more robust as I realized it was not working well on Visual Refresh (it was grabbing one level further up to the correct one). This is because the DOM structure rendered by the app layout can be different on Visual Refresh than Classic —and actually also when notifications are stick vs when they aren't.
@@ -208,6 +278,8 @@ the grid layout will be: | |||
flex-grow: 1; | |||
background: none; | |||
border: 0 none; | |||
padding-top: 0; |
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.
These two lines were moved from lines 140-141 because it only needs to affect .button
and not .status > .header
nor .status > .item-count
. See #772 for more context on what these two lines are for.
Description
This PR improves the Flashbar's support for compact mode and the usage of
disableContentPaddings
. It does basically two things:disableContentPaddings
and the notification bar is shown (to make sure it does not overlap the main content)How has this been tested?
A lot of manual checking on the new page
app-layout/with-stacked-notifications-and-table
. Visual regression tests on this page can be done after this PR is merged. Existing visual regression tests for Flashbar are expected to fail because of small changes in the notification bar position and also because of changes in the component's bottom margin which change the screenshot area.To manually test the changes, I suggest to visit the page
app-layout/with-stacked-notifications-and-table
in the deployment below and verify the following, for each combination of compact mode vs comfortable mode, and Visual Refresh vs Classic:Review checklist
The following items are to be evaluated by the author(s) and the reviewer(s).
Correctness
CONTRIBUTING.md
.CONTRIBUTING.md
.Security
checkSafeUrl
function.Testing
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.