Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 - mWeb auto focus on reply in thread #37929
Fix - mWeb auto focus on reply in thread #37929
Changes from 17 commits
5e7121a
1450307
b7f306e
d7abc9d
f69df2a
69e6022
0d37448
c51602f
9e2c1d1
78d815b
1b9163c
aa4fe30
4c34830
31db23e
297cd03
2bf777e
822cf62
c27d74e
4a40236
335b5fa
6fd4517
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
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.
Nope. What we are trying to avoid for main composer is overriding of the focus callback;
onComposerFocus
is callback assigner so we should avoid overriding ofmainComposerFocusCallback
byfocusCallback
so whenisReportActionCompose
is true we reset it tonull
.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 still don't get the reasoning behind this. Why can't we just return early in the callback if
isReportActionCompose
istrue
?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.
What we want to achieve is when the focus is called from reply in thread we want to focus the compose in the newly created thread and we can do that via
mainComposerFocusCallback
set hereApp/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx
Lines 611 to 617 in 822cf62
But mainComposerFocusCallback are only called when
focusCallback
is not set.App/src/libs/ReportActionComposeFocusManager.ts
Lines 38 to 43 in 822cf62
So here what we want is to reset
focusCallback
to null so that our mainComposerFocusCallback will be called. But early returning, as U suggest, means we leave (without reseting) what was already set onfocusCallback
therefore ourmainComposerFocusCallback
will not be called.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.
Having a
shouldFocusForNative
param seems to encourages code that is not cross platform.Can we rename this to indicate the intended behavior regardless of what platform we are on?
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.
That isn't clear @marcaaron. Because we are early returning here
App/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx
Lines 612 to 613 in a4d01a8
willBlurTextInputOnTapOutside
is false only for natives so we are normally preventing focus for natives but in our case we have to manually focus it for natives too that's why I came up with the variable. What other name could we give?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.
Naming it
shouldReturnEarly
should be fine @FitseTLT. We do not support code that this written just for native platforms mixed together with the rest of the code. If we need to do something specific to the native platform, we usually create a separate file.native.ts
extension to keep proper separation of concerns.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.
Please add a comment here to explain why we are passing
true
.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.
added but can u check the comments.
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.
Let's avoid creating platform specific language.
Can you answer this question without referencing "native":
What behavior are we giving the callback by passing
true
?