-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[$1000] IOS - When using multiple lines for the Welcome message, after saving and returning, the app scrolls #30707
Comments
Job added to Upwork: https://www.upwork.com/jobs/~016160035c97c0cabe |
Triggered auto assignment to @isabelastisser ( |
Bug0 Triage Checklist (Main S/O)
|
Triggered auto assignment to Contributor-plus team member for initial proposal review - @cubuspl42 ( |
Other issues / discussions related to similar behaviour on iOS: ProposalPlease re-state the problem that we are trying to solve in this issueWhen using multiple lines for the Welcome message, after saving and returning back to editing, the app scrolls the multi-line input from the top to the bottom. What is the root cause of that problem?There's a race condition between Why I'm saying this ? Because when commenting out iOS: Native - Issue reproduced 100% rateScreen.Recording.2023-11-08.at.13.57.43.movNote: the current implementation is also problematic on MacOS: Firefox, where the input does get focused but there's a scroll glitch and no scrolling is performed.MacOS: FirefoxScreen.Recording.2023-11-17.at.01.44.42.movWhat changes do you think we should make in order to solve the problem?Considering the latest observations / suggestions from #30707 (comment), in order to ensure that we focus the input, as soon as possible, ensuring the cursor is at the end for both iOS and all other platforms, I'm proposing the following changes: Update the Updated @libs/UpdateMultilineInputRange/index.js+ import CONST from "@src/CONST";
+ let timeoutID = null;
/**
* Place the cursor at the end of the value (if there is a value in the input).
*
* When a multiline input contains a text value that goes beyond the scroll height, the cursor will be placed
* at the end of the text value, and automatically scroll the input field to this position after the field gains focus.
* This provides a better user experience in cases where the text in the field has to be edited. The auto-
* scroll behaviour works on all platforms except iOS native.
* See https://github.com/Expensify/App/issues/20836 for more details.
*
* @param {Object} input the input element
* @param {boolean} shouldAutoFocus
* @param {boolean} shouldDelay
*/
- // eslint-disable-next-line no-unused-vars
- export default function updateMultilineInputRange(input, shouldAutoFocus = true) {
+ export default function updateMultilineInputRange(input, shouldAutoFocus = false, shouldDelay = false) {
const setCursorToEnd = () => {
if (!input) {
return;
}
+ if (shouldAutoFocus) {
+ input.focus();
+ }
+ // The selection set has to be called after the focus, otherwise it will not work on Firefox
if (input.value && input.setSelectionRange) {
const length = input.value.length;
input.setSelectionRange(length, length);
// eslint-disable-next-line no-param-reassign
input.scrollTop = input.scrollHeight;
}
};
+ // Clear the timeout if it's already been set to prevent multiple invocations
+ if (timeoutID !== null) {
+ clearTimeout(timeoutID);
+ timeoutID = null;
+ }
+ if (shouldDelay) {
+ timeoutID = setTimeout(setCursorToEnd, CONST.ANIMATED_TRANSITION);
+ } else {
+ setCursorToEnd();
+ }
}
With this update to the function, the final code will look like this: // src/pages/ReportWelcomeMessagePage.js
ref={(el) => {
if (!el) {
return;
}
welcomeMessageInputRef.current = el;
- updateMultilineInputRange(welcomeMessageInputRef.current);
+ updateMultilineInputRange(welcomeMessageInputRef.current, true, true);
}} and the Note:considering that the same code using both What alternative solutions did you explore?Keeping the @hooks/useDelayedInputFocus/index.ts
By calling this hook instead of the Note:considering this alternative method's implementation, all VideosiOS: NativeScreen.Recording.2023-11-02.at.00.37.09.movMacOS: FirefoxScreen.Recording.2023-11-17.at.02.26.56.mov |
This comment was marked as outdated.
This comment was marked as outdated.
Hey @cubuspl42, can you please review the proposal above? Thanks! |
@ikevin127 The |
This comment was marked as outdated.
This comment was marked as outdated.
This is an iOS-specific issue.
Then, you provide the non-iOS implementation (from Doesn't this invalidate your root cause analysis? |
This comment was marked as outdated.
This comment was marked as outdated.
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
Is this a challenge to write I meant that, per the Expensify conventions (which I didn't invent), relying on What is preferred, per the conventions, is relying on platform file suffixes
I'm aware of this line, and I feel quite uncomfortable with it. I would like to see a solution that removes it (while keeping the problem it solves solved, of course...). |
This comment was marked as outdated.
This comment was marked as outdated.
Hey @cubuspl42, can you please review the proposal above? Thanks! |
Thank you for the update! While I appreciate the efforts and adjusting the solution to the feedback, I'm still not convinced by the solution. It feels extremely specific and work-aroundish. I have a strong intuition that we miss the bigger picture. There's a race of two pieces of logic that both affect focusing/scrolling/placing the cursor. I don't feel that adding I'd like make the race disappear completely.
Sure, but on the other hand, commenting out the |
This comment was marked as outdated.
This comment was marked as outdated.
Sure, but I didn't say that this is the solution. It's an observation. My conclusion so far is that our cross-platform goal here is: Focus the input, as soon as possible, ensuring the cursor is at the end. We have various platform-dependent constraints here, and we might have to challenge the existing code. I would expect a solid proposal that proves a full understanding of our focus-related problems and provides a clear, complex solution. Good starting point:
@isabelastisser Would you raise the bounty? Although the problem might seem trivial, solving it correctly requires a bit of engineering, as I summed up above. |
Another option is to float this around expert contributor group like Callstack. |
@cubuspl42 @isabelastisser this issue is now 3 weeks old. There is one more week left before this issue breaks WAQ and will need to go internal. What needs to happen to get a PR in review this week? Please create a thread in #expensify-open-source to discuss. Thanks! |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
Issue not reproducible during KI retests. (Second week) |
@cubuspl42, @isabelastisser Uh oh! This issue is overdue by 2 days. Don't forget to update your issues! |
@cubuspl42, @isabelastisser 6 days overdue. This is scarier than being forced to listen to Vogon poetry! |
Upwork job price has been updated to $1000 |
The bounty has been increased. Waiting for proposals! |
@cubuspl42 @isabelastisser this issue is now 4 weeks old and preventing us from maintaining WAQ, can you:
Thanks! |
Current assignee @cubuspl42 is eligible for the Internal assigner, not assigning anyone new. |
🎀 👀 🎀 |
Triggered auto assignment to @techievivek, see https://stackoverflow.com/c/expensify/questions/7972 for more details. |
I don't think so
@techievivek I never entered this path, does it mean that I would be responsible for solving this issue, and you would review the PR? |
Issue not reproducible during KI retests. (Third week) |
Aaah, no, that means that the internal engineer who is assigned to the GH should now start looking into the issue rather than keeping it external and hoping some contributor would work on it. |
It looks like this is no longer reproducible. @cubuspl42 are you still able to reproduce this issue? |
@techievivek Ouch. I checked and it's indeed not reproducible. 🙈 I should've caught up that earlier. |
Great, closing it then. Thanks. |
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: 1.2.94.0
**Reproducible in staging?:**Y
**Reproducible in production?:**Y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: Applause - Internal Team
Slack conversation:
Issue found when executing PR #30238
Action Performed:
Expected Result:
When using multiple lines for the Welcome message, after saving and returning, the app should not scroll the message from the top to the bottom
Actual Result:
When using multiple lines for the Welcome message, after saving and returning, the app scrolls the message from the top to the bottom
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
Bug6259537_1698852395381.RPReplay_Final1698850932__1_.mp4
View all open jobs on GitHub
Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: