Skip to content

[Awaiting Checklist] [$250] Desktop - Workspace - Blue frame appears after pressing enter while uploading a new avatar #71872

Closed

Description

@mitarachim

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: v9.2.23-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from TestRail: https://test-management.browserstack.com/projects/2219752/test-runs/TR-1144/folder/13177019/41237781/933089030?sort=%2Bidentifier
Email or phone of affected tester (no customers): n/a
Issue reported by: Applause Internal Team
Device used: Mac 15.4.1 Desktop
App Component: Workspace Settings

Action Performed:

Preconditions: Workspace has a default avatar

  1. Open the app
  2. Navigate to Workspace settings
  3. Click on the Workspace avatar
  4. Click on upload photo and select any image
    5.Press Enter to save the new avatar

Expected Result:

Blue frame should not appear after pressing Enter while uploading a new avatar

Actual Result:

Blue frame appears after pressing enter while uploading a new avatar

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Image
Bug6964267_1759532281976.avatar.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021975259774452765689
  • Upwork Job ID: 1975259774452765689
  • Last Price Increase: 2025-10-20
  • Automatic offers:
    • daledah | Contributor | 109204888
Issue OwnerCurrent Issue Owner: @garrettmknight

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Oct 6, 2025
  2. melvin-bot commented on Oct 6, 2025

    @melvin-bot

    Triggered auto assignment to @garrettmknight (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.

  3. daledah commented on Oct 6, 2025

    @daledah
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    Blue frame appears after pressing enter while uploading a new avatar

    What is the root cause of that problem?

    We applies a box-shadow to elements when they are in the focus-visible state here

    App/web/index.html

    Lines 64 to 67 in b1a83aa

    :focus-visible {
    outline: 0;
    box-shadow: inset 0px 0px 0px 1px #5AB0FF;
    }

    What changes do you think we should make in order to solve the problem?

    1. We should use anchorRef?.current?.blur() to blur the button here when the user presses it
        const onPressAvatar = useCallback(
            (openPicker: OpenPicker) => {
                anchorRef.current?.blur();
                ...
            },
        );
    

    Like the way we did here

    onPress={callFunctionIfActionIsAllowed(() => {
    pressableRef?.current?.blur();

    1. Then pass anchorRef to the dependency of the useCallBack function

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    None

    What alternative solutions did you explore? (Optional)

    Or we just need to prevent the button from being focused when clicking on it:

                <PressableWithoutFeedback
                    onMouseDown={(e) => e.preventDefault()}
    

    Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

  4. nkdengineer commented on Oct 6, 2025

    @nkdengineer
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    Blue frame appears after pressing enter while uploading a new avatar

    What is the root cause of that problem?

    In setReturnFocus, we always return to the element that was focused before activation.

    setReturnFocus: (element) => {
    if (ReportActionComposeFocusManager.isFocused()) {
    return false;
    }
    return element;
    },
    }}

    /**
    * By default, focus trap on deactivation will return to the element
    * that was focused before activation.
    */
    setReturnFocus?:
    | FocusTargetValueOrFalse
    | ((
    nodeFocusedBeforeActivation: HTMLElement | SVGElement
    ) => FocusTargetValueOrFalse);

    What changes do you think we should make in order to solve the problem?

    In this PR, we also tried to blur the activeElement, but it's just the workaround so we face the same issue again

    In FocusTrapForModal, we can remove setReturnFocus, then set returnFocusOnDeactivate to false

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    None

    What alternative solutions did you explore? (Optional)

    Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

  5. Eskalifer1 commented on Oct 6, 2025

    @Eskalifer1
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    Workspace - Blue frame appears after pressing enter while uploading a new avatar

    What is the root cause of that problem?

    We try to return to the last active element in focusTrapForModal:

    setReturnFocus: (element) => {
    if (ReportActionComposeFocusManager.isFocused()) {
    return false;
    }
    return element;
    },

    This is why, after closing the modal window, we focus the element for loading the avatar

    What changes do you think we should make in order to solve the problem?

    We need to add onBlur during avatar loading, which can be added here:

    if (isUsingDefaultAvatar) {
    openPicker({
    onPicked: (data) => showAvatarCropModal(data.at(0) ?? {}),
    });
    return;
    }

    Or here:

    openPicker: ({onPicked: newOnPicked, onCanceled: newOnCanceled = () => {}}) => {
    if (isPickingRef.current) {
    return;
    }
    isPickingRef.current = true;
    onPicked.current = newOnPicked;
    fileInput.current?.click();
    onCanceled.current = newOnCanceled;
    },

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    N/A

    What alternative solutions did you explore? (Optional)

    We can dynamically pass returnFocusOnDeactivate and set its default value to true (or not set a default value) and pass false in this case.
    Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

  6. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Oct 6, 2025
  7. changed the title [-]Desktop - Workspace - Blue frame appears after pressing enter while uploading a new avatar[/-] [+][$250] Desktop - Workspace - Blue frame appears after pressing enter while uploading a new avatar[/+] on Oct 6, 2025
  8. melvin-bot commented on Oct 6, 2025

    @melvin-bot
  9. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Oct 6, 2025
  10. melvin-bot commented on Oct 6, 2025

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @sobitneupane (External)

  11. self-assigned this
    on Oct 9, 2025
  12. 38 remaining items

  13. garrettmknight commented on Nov 18, 2025

    @garrettmknight
    Contributor

    Payment Summary

  14. changed the title [-][READY FOR PAYMENT][$250] Desktop - Workspace - Blue frame appears after pressing enter while uploading a new avatar[/-] [+][Awaiting Checklist] [$250] Desktop - Workspace - Blue frame appears after pressing enter while uploading a new avatar[/+] on Nov 18, 2025
  15. garrettmknight commented on Nov 21, 2025

    @garrettmknight
    Contributor

    @sobitneupane checklist please

  16. mjasikowski commented on Nov 24, 2025

    @mjasikowski
    Contributor
  17. sobitneupane commented on Nov 24, 2025

    @sobitneupane
    Contributor

    Regression Test Proposal

    Precondition:

    • Workspace has a default avatar

    Test:

    1. Navigate to Workspace settings
    2. Click on the Workspace avatar
    3. Click on upload photo and select any image
    4. Press Enter(keyboard) to save the new avatar
    5. Verify that: There's no blue border around the newly uploaded avatar.

    Do we agree 👍 or 👎

  18. sobitneupane commented on Nov 24, 2025

    @sobitneupane
    Contributor

    BugZero Checklist:

    • [Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

      The issue is probably caused by this PR as it returns focus to the previous element.

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

      Link to discussion:

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

      Link to issue:

  19. garrettmknight commented on Nov 24, 2025

    @garrettmknight
    Contributor
  20. quinthar commented on Dec 8, 2025

    @quinthar
    Contributor

    Approved $250 to @sobitneupane

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions