Open IuliiaHerets opened 2 weeks ago
Triggered auto assignment to @zanyrenney (Bug
), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.
@zanyrenney FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors
Job added to Upwork: https://www.upwork.com/jobs/~021836866672094965087
Triggered auto assignment to Contributor-plus team member for initial proposal review - @paultsimura (External
)
Fix send button being activated only after entering a space on Chrome for Android
When typing using Android's keyboard, only the input
event is triggered, while pressing space or typing using an external keyboard activates the textInput
event, which enables the send button.
That's likely caused by a difference on how onChange
and onChangeText
are handled by the TextInput
component on web.
https://github.com/user-attachments/assets/fb813f1b-988d-4862-8919-aba2698f5358
Replace the usage of onChangeText
by onChange
on the line below:
https://github.com/Expensify/App/blob/main/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx#L773
๐ฃ @mattmoreira! ๐ฃ Hey, it seems we donโt have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork. Please follow these steps:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>
Contributor details
Your Expensify account email: matheus.moreira@pixelias.io Upwork Profile Link: https://www.upwork.com/freelancers/~011382b37ba6ccea27?mp_source=share
โ Contributor details stored successfully. Thank you for contributing to Expensify!
I cannot reproduce on main ๐ค
@paultsimura can you checkout the staging branch and production tags and confirm its reproducible there?
@bondydaa still no luck โย works fine on both staging & prod. I will request in the C+ channel, maybe somebody will manage to reproduce & take over.
I am able to re-produce this issue, taking over (slack), @bondydaa @zanyrenney can someone please assign me here, thanks :)
https://github.com/user-attachments/assets/52be78a0-548d-41ea-8c4d-d6045e0cb3c6
@bondydaa and @paultsimura, I had already reproduced the bug, please check my prior comment in thread where I issued a proposal on how to fix this.
@bondydaa and @paultsimura, I had already reproduced the bug, please check my prior comment in thread where I issued a proposal on how to fix this.
I am taking over as C+ @mattmoreira , not as a contributor ๐
@mattmoreira , can you please explain in your RCA why this is only reproducible on android web and not other platforms, please try to dig in deeper, also I think your solution is not correct, please dig in why onChangeText
was used here at the first place
@allgandalf I'll explain later why I proposed to use onChange instead of onChangeText.
Regarding why it happens only on Chrome for Android, I suspect it's related to the following issue that was reported on Chromium's bug tracker:
Ok, I'll provide now more details:
Chrome on Android uses Blink as a rendering engine, while for iOS, Chrome works basically as a reskinned version of Safari: https://news.ycombinator.com/item?id=25850091
Also, according to this comment on Chromium's bug tracker, the textInput
event is behaving as intended by not "committing" the new character until space is pressed, as the string might be changed by the autocorrector.
That doesn't happen on desktop because we use real keyboards for typing, while Gboard acts as an input method (IME), having complete control of when the string actually gets sent to the element.
onChangeText
is being used?The biggest difference between onChangeText
and onChange
is that the first only returns the string that was input, while the latter returns the synthetic event. That led me to believe that perhaps the onChange
was being triggered by the input
event, but after further research, I discovered that they're both triggered by the same event.
So, yes @allgandalf, you're correct, replacing onChangeText
with onChange
wouldn't solve the issue.
Also, it seems that the element is not actually an input
, but rather a content editable div
. This explains why the real change
event wasn't used, as it doesn't work with div
s.
Another solution would be to use onKeyPress
to identify when the element has changed, and then grab the new value using innerText
on the target element.
In the chat the send button is not enabled when the user starts typing on mobile browsers
The root cause of the issue is mobile keyboard behavior's when text prediction is enabled. I have tested this one the mobile chrome browser with the google gBoard and Samsung keyboard on S22FE and only in the samsung keyboard I've been able to reproduce the issue.
The Google keyboard generates when typing events with eventType=input and inputType=insertText.
The Samsung keyboard generates when typing events with eventType=input and inputType=insertCompositionText.
Due to the inputType being wrong in the event it is not being picked up by react with the onInput event which is what the react-native-live-markdown
library use to expose the onChangeText.
We need to fix this in the live markdown library.
We can leverage the composition events to get the text by adding a listener to onCompositionUpdate
in this line:
https://github.com/Expensify/react-native-live-markdown/blob/a70e8570658a3654aa34d7817188474890c1fe15/src/MarkdownTextInput.web.tsx#L688
The event would use an updateComposition
function to update the text by calling the onChangeText
function:
const updateComposition = useCallback(
(e) => {
handleOnChangeText(e);
},
[handleOnChangeText],
);
๐ฃ @allgandalf ๐ An offer has been automatically sent to your Upwork account for the Contributor role ๐ Thanks for contributing to the Expensify app!
Offer link Upwork job Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review ๐งโ๐ป Keep in mind: Code of Conduct | Contributing ๐
dang it, that's what I was trying to avoid ๐คฆ guess i should have taken external
off as well before try to re-assign?
anyways @allgandalf you're the c+ assigned now, we can get the job stuff figured out when Zany is back tomorrow b/c now I'm not sure what I need to do.
lesson for the next time ๐ ,
anyways @allgandalf you're the c+ assigned now, we can get the job stuff figured out when Zany is back tomorrow b/c now I'm not sure what I need to do.
No hurry !! Still waiting for proper proposals
No hurry !! Still waiting for proper proposals
@allgandalf I've tried to address here the points that were unclear, could you please provide me guidance on what other areas would you like to be clarified in my proposal?
Send button is only enabled when adding white space to the composer.
The send button will be enabled if the isCommentEmpty
state is false. We update the state inside the updateComment
function.
https://github.com/Expensify/App/blob/accea60e318386b02971baab3a563160ce8259b5/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx#L432-L434
updateComment
is called from the composer onChangeText
.
https://github.com/Expensify/App/blob/accea60e318386b02971baab3a563160ce8259b5/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx#L509-L511
However, the onChangeText
isn't called. This is because, in the live markdown component, if compositionRef
is true, then we return early which never reaches the onChangeText
calls.
https://github.com/Expensify/react-native-live-markdown/blob/a70e8570658a3654aa34d7817188474890c1fe15/src/MarkdownTextInput.web.tsx#L307-L316
compositionRef
is true when we start typing, only if the auto-correct of the keyboard is enabled. It becomes false when we press space which ends the composition (it triggers onCompositionEnd event).
We need to trigger onChangeText
even when compositionRef
is true, the same we trigger selection change event (updateSelection
).
https://github.com/Expensify/react-native-live-markdown/blob/a70e8570658a3654aa34d7817188474890c1fe15/src/MarkdownTextInput.web.tsx#L307-L315
if (compositionRef.current) {
updateTextColor(divRef.current, parsedText);
updateSelection(e, {
start: newCursorPosition,
end: newCursorPosition
});
if (onChangeText) {
onChangeText(parsedText);
}
...
@allgandalf are you able to review the proposal from @bernhardoj please?
Just an FYI I'll be OOO until Tuesday 1st, please reapply the bug label if this needs urgent action in my absence. Otherwise I will get to it when I return. Thanks!
๐ฃ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? ๐ธ
@bondydaa, @zanyrenney, @allgandalf Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
Just an FYI I'll be OOO until Tuesday 1st, please reapply the bug label if this needs urgent action in my absence. Otherwise I will get to it when I return. Thanks!
Oops sorry I didn't realise there was a proposal, I will review it tomorrow / over the weekend, thanks :)
@bondydaa, @zanyrenney, @allgandalf Whoops! This issue is 2 days overdue. Let's get this updated quick!
not overdue melvin!
๐ฃ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? ๐ธ
@bondydaa @zanyrenney @allgandalf this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!
Not overdue melvin
added to the collect project as a key feature of admins needing to pay, is paying. Added to polish.
@bondydaa, @zanyrenney, @allgandalf Whoops! This issue is 2 days overdue. Let's get this updated quick!
@allgandalf any updates?
Can you add re-test label here? I think this has been fixed upstream
If you havenโt already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: 9.0.38-0 Reproducible in staging?: Y Reproducible in production?: Y Issue reported by: Applause Internal Team
Action Performed:
Expected Result:
Send activated after entering few characters.
Actual Result:
Send button is activated in mweb only after entering a space. Issue occurs when using the device's own keyboard.
Workaround:
Unknown
Platforms:
Screenshots/Videos
https://github.com/user-attachments/assets/0b88bd41-2053-4f49-8b6d-5714b11b76f5
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @allgandalf