-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Make it possible to locally prevent event propagation #9749
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,10 @@ const ChangeExpensifyLoginLink = props => ( | |
<TouchableOpacity | ||
style={[styles.link]} | ||
onPress={Session.clearSignInData} | ||
onKeyDownCapture={(e) => { | ||
e.stopPropagation(); | ||
Session.clearSignInData(); | ||
}} | ||
Comment on lines
+43
to
+46
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess so but I don't have ideas on this. Rory will have better ideas on this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah, I think you would have to add this code to every such component OR create a wrapper component like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we do the reverse? Create a form wrapper component and add There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @roryabraham Are these changes you are expecting here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah that POC looks good to me 👍 |
||
underlayColor={themeColors.componentBG} | ||
> | ||
<Text style={[styles.link]}> | ||
|
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 believe this code is not required. Could you explain why did you add this?
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 recall right now, but found that it was necessary in my testing, which was pretty thorough for the login page.
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 the idea is that we establish these event handlers in the bubbling phase so that further down in the DOM we can prevent them from being triggered in the capture phase.
If you have a capture-phase handler at the document root, then there's no way to prevent it from executing first