Add Alert Group demo#7843
Conversation
|
Preview: https://patternfly-react-pr-7843.surge.sh A11y report: https://patternfly-react-pr-7843-a11y.surge.sh |
|
I believe that the main issue here is actually rooted in The problem with that specific approach is that the |
Thanks! This was definitely one of the reasons. Maybe it will be worth creating a separate issue where we could discuss what could be used instead of If you are curious, the problem was a bit trickier in the demo, because I was tying to remove alert with |
|
I went ahead and made an issue for the index bug #7877 and put up a PR #7878 (draft for now because I want to add a test when I get a moment). I may not be understanding your issue properly. I pulled your branch and as with my smaller scale testing fixing the If you could try making the same changes I did and let me know what the others issue are that I'm missing I can take a look into them 🙂 |
|
Soo I compared your branch with mine and found out that the other problem was in then all alerts were dismissed at once. Just me being curious, could you explain why this approach doesn't work? I didn't find any particular reason for that. |
|
From my understanding of things, I believe what's happening here is that with your original approach When using the functional update form in the I might not be 100% right with this explanation as the react docs aren't super clear about it (they just say to use the functional update form if your new state is dependent on the current state, but don't say why) and when going through blog posts and SO threads there's lots of conflicting "information" about the topic, but this explanation is what makes the most sense to me based on everything I've read and my own testing 😅 |
Signed-off-by: Tomas Psota <tpsota@redhat.com>
Signed-off-by: Tomas Psota <tpsota@redhat.com>
Signed-off-by: Tomas Psota <tpsota@redhat.com>
00744db to
02ad5de
Compare
02ad5de to
3f3a047
Compare
thatblindgeye
left a comment
There was a problem hiding this comment.
This is looking great so far! 🎉 I had some comments below (some a little more nitpicky than others, so let me know what you think), but awesome job working on this!
wise-king-sullyman
left a comment
There was a problem hiding this comment.
I think this is looking really great! I just have a couple of really small nits and one comment that would help DRY things up a touch 🙂
|
I noticed that the combination of Alert Group with overflow and having the most recent alert on top causes the timeout of alerts that are 'hidden' to start just after they appear on screen. We discussed this with Austin and we'd like to hear also the opinion from @mcarrano We found two possible solutions:
Personally, I would prefer the first option. IMO, the second one kind of goes against the purpose of the demo - it should showcase what can be built with the components. When we add add custom timeout handling, then we would showcase just something tailored to the demo instead of the functionality of the The example below shows that the oldest success alert is pushed out to the overflow and its timeout starts just after it is again displayed on the screen, after other (newer) alerts disappear. The timeout is 7 seconds. alerts_behavior.mov |
|
@tompsota @wise-king-sullyman I think the suggestion to leave this as it is now is fine. I admit that it is a bit odd, but in reality I don't think you'd want to use this overflow feature together with alerts that time out. The purpose of this is more to manage a queue of alerts that you want the user to read and dismiss manually. Maybe the demo should be set up that way. BTW, I don't seem to be seeing this demo when I preview the PR. Shouldn't this be showing on a demo tab? |
@mcarrano currently the demo is in the "Demos" section of the side-nav. |
Moved the demo to the demo tab |
thatblindgeye
left a comment
There was a problem hiding this comment.
Looking great! I had a couple additional comments below (one nit that I won't block over and one that might be more a CSS issue). I think I'd agree with Matt's comment above about the demo showing alerts that are dismissed manually rather than via timeout, but that isn't really a blocker for me.
|
|
||
| ## Demos | ||
|
|
||
| This demonstrates how you can assemble a full page view including the use of alert group toast notifications with timeout that are also displayed inside the notification drawer. |
There was a problem hiding this comment.
This could be moved below the example title heading, but since this is the only demo right now I'd also be fine with it being kept where it is.
| position={DropdownPosition.right} | ||
| /> | ||
| </NotificationDrawerHeader> | ||
| <NotificationDrawerBody> |
There was a problem hiding this comment.
@mcoker currently the last alert in the NotificationDrawerBody causes and overflow when its kebab toggle is opened, even if there's enough vertical room for the kebab dropdown:
Either disabled the overflow-y: auto property or adding a height property to pf-c-notification-drawer__body resolves it (I only added a height: 100% to the element to test quickly). I haven't tested with any flex properties , though (since the body element is in the pf-c-notification-drawer flex container).
Do you think this would be an update that could be made in Core, or maybe just a style specific to this demo?
There was a problem hiding this comment.
@thatblindgeye nice catch! That looks like a bug in core to me - patternfly/patternfly#5091
mcoker
left a comment
There was a problem hiding this comment.
LGTM! Left some comments, but I don't think any are blockers.
|
|
||
| return ( | ||
| <DashboardWrapper | ||
| header={<DashboardHeader notificationBadge={notificationBadge} />} |
There was a problem hiding this comment.
This may be out of scope, but if you've passed notificationDrawer, I'm wondering if that could be used to create the notification badge automatically and you may be able to remove this? It would be great to make the dashboard wrapper handle showing the notification badge any time there is a notification drawer (and don't show it if there isn't a notification drawer), and ideally handle showing the notification badge state consistently.
There was a problem hiding this comment.
@mcoker That definitely is possible and I agree that it would be more consistent.. However, I cannot think about any neat solution. We could access the NotificationDrawerListItems through children of notificationDrawer and extract the required data from there, but that approach requires to go quite deep into the tree and there won't be any guarantee that the required props (variant, isRead) are set. I'd suggest to leave this as it is for now and maybe open this in a new issue, @thatblindgeye what do you think?
There was a problem hiding this comment.
I haven't yet tried looking into it more closely, but I would agree that this would make sense as a follow-up issue.
| import { useEffect } from 'react'; | ||
| import BellIcon from '@patternfly/react-icons/dist/js/icons/bell-icon'; | ||
| import SearchIcon from '@patternfly/react-icons/dist/js/icons/search-icon'; | ||
| import DashboardWrapper from './examples/DashboardWrapper'; | ||
| import DashboardHeader from './examples/DashboardHeader'; |
There was a problem hiding this comment.
This is probably fine, I just wanted to ask if these need to be imported here since they're also imported in AlertGroupToastWithNotificationDrawer.tsx?
There was a problem hiding this comment.
They need to be imported also here, we would get ReferenceError otherwise
@thatblindgeye I don't have any problem with removing timeout from the alerts. When I was implementing this demo, I followed the design doc which mentions that the alerts should have the timeout set to 8 seconds. Here is the design doc, it is mentioned in the 'Behavior' section |
wise-king-sullyman
left a comment
There was a problem hiding this comment.
Awesome work on this! 🔥
thatblindgeye
left a comment
There was a problem hiding this comment.
@tompsota regarding your latest reply, since it follows the design guidelines I'm fine with it as-is, and would defer to Matt/design regarding whether the demo should have timeouts removed as part of this PR or if it's something to circle back to at some point.
Echoing above, awesome work! 🎉
|
@tompsota @thatblindgeye I'm also fine to merge this as is. Maybe we should reconsider what the design recommendation is for this. I'll queue that up for some discucssion, but no reason to hold this up further. |
84585c9 to
971aebf
Compare
|
Your changes have been released in:
Thanks for your contribution! 🎉 |

What: Closes #7008