-
Notifications
You must be signed in to change notification settings - Fork 960
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: Fix links in Announcements #1934
fix: Fix links in Announcements #1934
Conversation
Signed-off-by: Ozan Dogrultan <ozan.dogrultan@deliveryhero.com>
Signed-off-by: Ozan Dogrultan <ozan.dogrultan@deliveryhero.com>
Signed-off-by: Ozan Dogrultan <ozan.dogrultan@deliveryhero.com>
cc @Golodhros |
@Golodhros could you review this please? 🙏🏼 |
<div | ||
className="card-copy" | ||
role="button" | ||
tabIndex={0} | ||
onClick={stopEvent} | ||
onKeyDown={stopEvent} | ||
> | ||
{copy} | ||
</div> |
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 creation of a fake button and adding a stop propagation handler to it seems a bit fishy to me.
Could we achieve the same effect by using CSS pointer-events?
Check in https://css-tricks.com/almanac/properties/p/pointer-events/
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.
Thanks for the link!
I've tried using pointer-events
on both child and parent elements, however click event is always propagated to the Card component which results in following the navigation..
Could you be more specific on how we can use pointer-events
here?
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 is something like this: https://stackoverflow.com/a/46707009
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 tried this suggestion as well, but it didn't work either.. but I might be doing something wrong, I don't have much experience with pointer-events
Another option in my opinion is that eventPropagation can be stopped on the SanitizedHtml level here
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.
if we stop the propagation in the "html_content" level it also works, but for me it's just another workaround and doesn't solve the problem fully
Signed-off-by: Ozan Dogrultan <ozan.dogrultan@deliveryhero.com>
Signed-off-by: Ozan Dogrultan <ozan.dogrultan@deliveryhero.com>
Signed-off-by: Ozan Dogrultan <ozan.dogrultan@deliveryhero.com>
Signed-off-by: Ozan Dogrultan <ozan.dogrultan@deliveryhero.com>
Signed-off-by: Ozan Dogrultan <ozan.dogrultan@deliveryhero.com>
Signed-off-by: Ozan Dogrultan <ozan.dogrultan@deliveryhero.com>
Signed-off-by: Ozan Dogrultan <ozan.dogrultan@deliveryhero.com>
Signed-off-by: Ozan Dogrultan <ozan.dogrultan@deliveryhero.com>
Signed-off-by: Ozan Dogrultan <ozan.dogrultan@deliveryhero.com>
Signed-off-by: Ozan Dogrultan <ozan.dogrultan@deliveryhero.com>
Signed-off-by: Ozan Dogrultan <ozan.dogrultan@deliveryhero.com>
Signed-off-by: Ozan Dogrultan <ozan.dogrultan@deliveryhero.com>
@Golodhros I've changed the fix strategy slightly with the latest changes. Now the only change is to allow |
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
Signed-off-by: Ozan Dogrultan <ozan.dogrultan@deliveryhero.com>
Signed-off-by: Ozan Dogrultan ozan.dogrultan@deliveryhero.com
Fixes #1875
Summary of Changes
Previously, when there were links in the Announcement html content, they were overridden by the navigation of the Card component and when they were clicked, announcement list page was shown instead of the link itself.
The changes in the PR introduces the logic the stop bubbling up the click event to the Card component so that the link navigation works as expected.
Tests
No test change is needed.
Documentation
No documentation change is needed.
CheckList
Make sure you have checked all steps below to ensure a timely review.