You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[$500] Assign task - Invalid red dot appears by closing assign the tab when there's no prior action #31583
Version Number: 1.4.1-5 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:
changed the title [-]Assign task - Invalid red dot appears by closing assign the tab when there's no prior action[/-][+][$500] Assign task - Invalid red dot appears by closing assign the tab when there's no prior action[/+]on Nov 20, 2023
Please re-state the problem that we are trying to solve in this issue.
When clicking and holding back button or any spot outside of the RHN while assign task view is open, the Title field displays a validation error for as long as press/click is held.
What is the root cause of that problem?
Our form validation intentionally shows a validation error for required fields if they are focused and then blurred. We are autofocusing the field on form open, and by pressing a focusable element, such as outside of the RHN or the back button, we're blurring the input and triggering validation. Note that this is not really a bug, but a side effect of how the validation works.
What changes do you think we should make in order to solve the problem?
The only reason this seems jarring is because the user hasn't interacted with the form yet, and they didn't manually focus the field, so an error message isn't expected. I would not recommend special handling of this particular case, but that we stick to a design pattern.
We should decide either:
We want to continue validating required fields immediately on blur, and leave this as is, or
We don't like the side effects of showing missing required fields errors prematurely, so we'll show them only after the first form submission. This would only impact required field errors, all other error types would continue to show once the field is dirty as we currently do.
Going with approach # 2 means that, if the user hasn't submitted the form, they won't see the validation error that we currently do.
They will see it after first submission attempt, but will no longer be surprising because they would have already seen this error on submission and it makes sense. But it also means we're not giving immediate feedback as they focus in and out of required fields before the first submission. We already show (optional) for optional fields, implying that others are required, so I think this is an acceptable approach.
What alternative solutions did you explore?
If we really don't like the specific behavior outlined in this issue, but don't want to change our error validation pattern, we could:
Not autofocus this field on RHN open - this is probably very undesirable, not recommended, but we could do it.
Some kind of hack where we specifically recognize that the user is clicking away from the form. This will involve focus management trickery and pain, highly recommend against this kind of heavy solution to alleviate low/no impact behavior.
I've tested all cases and it works well on web/desktop/mweb
Unfortunately, on native devices, onClick of back button is triggered first -> onBlur of input. And there's no such thing as the relatedTarget, that why on native we should detect if users have just clicked on the back button so we can avoid triggering onBlur
defined new getJustClickedBackButton and setJustClickedBackButton in the new file named justClickedBackButton.ts,
I'm not sure but perhaps someone can confirm this, but I think maybe this should wait until the From Provider Refractor is finalized since it will include the behaviour of NewTaskDetailsPage as mentioned in the comment
Activity
[-]Assign task - Invalid red dot appears by closing assign the tab when there's no prior action[/-][+][$500] Assign task - Invalid red dot appears by closing assign the tab when there's no prior action[/+]melvin-bot commentedon Nov 20, 2023
Triggered auto assignment to @garrettmknight (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.melvin-bot commentedon Nov 20, 2023
Job added to Upwork: https://www.upwork.com/jobs/~01690c0dbaf0deaaf7
melvin-bot commentedon Nov 20, 2023
Bug0 Triage Checklist (Main S/O)
Platformsin OP are ✅)melvin-bot commentedon Nov 20, 2023
Triggered auto assignment to Contributor-plus team member for initial proposal review - @parasharrajat (
External)cooldev900 commentedon Nov 20, 2023
I am not able to reproduce it on dev.
erquhart commentedon Nov 20, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
When clicking and holding back button or any spot outside of the RHN while assign task view is open, the Title field displays a validation error for as long as press/click is held.
What is the root cause of that problem?
Our form validation intentionally shows a validation error for required fields if they are focused and then blurred. We are autofocusing the field on form open, and by pressing a focusable element, such as outside of the RHN or the back button, we're blurring the input and triggering validation. Note that this is not really a bug, but a side effect of how the validation works.
What changes do you think we should make in order to solve the problem?
The only reason this seems jarring is because the user hasn't interacted with the form yet, and they didn't manually focus the field, so an error message isn't expected. I would not recommend special handling of this particular case, but that we stick to a design pattern.
We should decide either:
Going with approach # 2 means that, if the user hasn't submitted the form, they won't see the validation error that we currently do.
They will see it after first submission attempt, but will no longer be surprising because they would have already seen this error on submission and it makes sense. But it also means we're not giving immediate feedback as they focus in and out of required fields before the first submission. We already show (optional) for optional fields, implying that others are required, so I think this is an acceptable approach.
What alternative solutions did you explore?
If we really don't like the specific behavior outlined in this issue, but don't want to change our error validation pattern, we could:
tienifr commentedon Nov 21, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
Assign task - Invalid red dot appears by closing assign the tab when there's no prior action
What is the root cause of that problem?
When users blur the input, validate function is always triggered, that makes the error messages appear
App/src/components/Form/FormProvider.js
Line 272 in 72e73ae
What changes do you think we should make in order to solve the problem?
on web/desktop, onBlur of input is triggered first -> onClick of back button.
We should check if the
relatedTarget(next focus element) does not contain thecurrentTarget(the input), then we can early return.I've tested all cases and it works well on web/desktop/mweb
Unfortunately, on native devices, onClick of back button is triggered first -> onBlur of input. And there's no such thing as the relatedTarget, that why on native we should detect if users have just clicked on the back button so we can avoid triggering onBlur
defined new getJustClickedBackButton and setJustClickedBackButton in the new file named
justClickedBackButton.ts,setJustClickedBackButton(true) in here
setJustClickedBackButton(false) when HeaderWithBackButton is unmounted
Update the condition above to
Result
Web/Desktop
https://github.com/Expensify/App/assets/113963320/374d9429-5403-419e-add0-aa88dd2b7b10
Native/Ios
https://github.com/Expensify/App/assets/113963320/c22b33c0-d40b-43b0-acba-5a3f646a977b
AmjedNazzal commentedon Nov 21, 2023
I'm not sure but perhaps someone can confirm this, but I think maybe this should wait until the From Provider Refractor is finalized since it will include the behaviour of
NewTaskDetailsPageas mentioned in the commentparasharrajat commentedon Nov 21, 2023
I don't think this is a real issue. It's not worth changing. @garrettmknight Thoughts?
erquhart commentedon Nov 21, 2023
The one thing that does feel off is that the invalid state is clearly visible while the RHN is closing on web/desktop, without holding the click.
Screen.Recording.2023-11-21.at.8.53.43.AM.mov
garrettmknight commentedon Nov 21, 2023
@parasharrajat agreed, this isn't worth fixing right now.
erquhart commentedon Nov 21, 2023
cool cool good talk