Skip to content

[$500] Room - First workspace becomes highlighted by default when creating new room for 2nd time #34393

Closed

Description

@lanitochka17

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.4.24-4
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:

Action Performed:

  1. Click on FAB > New Chat > room > workspace
  2. Observe no workspace is highlighted
  3. Select the first workspace
  4. Click outside of the panel to close it
  5. Re do step 1

Expected Result:

No workspace should be highlighted by default

Actual Result:

The first workspace becomes highlighted

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6339358_1705005197988.workspaceRoomHighlighted.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01bc4717bf898902a4
  • Upwork Job ID: 1745546481285779456
  • Last Price Increase: 2024-02-01

Activity

  1. added
    ExternalAdded to denote the issue can be worked on by a contributor
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jan 11, 2024
  2. changed the title [-]Room - First workspace becomes highlighted by default when creating new room for 2nd time[/-] [+][$500] Room - First workspace becomes highlighted by default when creating new room for 2nd time[/+] on Jan 11, 2024
  3. melvin-bot commented on Jan 11, 2024

    @melvin-bot
  4. melvin-bot commented on Jan 11, 2024

    @melvin-bot

    Triggered auto assignment to @sophiepintoraetz (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

  5. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Jan 11, 2024
  6. melvin-bot commented on Jan 11, 2024

    @melvin-bot

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

  7. rushatgabhane commented on Jan 11, 2024

    @rushatgabhane
    Member

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

    In selection list, the focusedIndex is set as 0 even tho it should be -1

    What is the root cause of that problem?

    This happens because when sections change after first render of SelectionList, updateAndScrollToFocusedIndex is called.

    It sets the index focused index to 0.

    if (sections.length > 0) {
    updateAndScrollToFocusedIndex(0);
    }

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

    Change the dependency array of the useEffect to update only when its length changes [sections?.length]

  8. Krishna2323 commented on Jan 11, 2024

    @Krishna2323
    Contributor

    Proposal

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

    Room - First workspace becomes highlighted by default when creating new room for 2nd time

    What is the root cause of that problem?

    We don't highlight the first option in the SelectionList because if we don't pass initiallyFocusedOptionKey no option will be focused because the fallback for focusedIndexis set to -1. Due to the updateAndScrollToFocusedIndex, the first option is highlighted sometimes.

    if (sections.length > 0) {
    updateAndScrollToFocusedIndex(0);
    }

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

    In my opinion, we should set the fallback for focusedIndex to 0 because in almost every SelectionList components, the first option is always highlighted. I believe it is good for the user experience to indicate that it can also be changed through keyboard navigation.

    We can just update this line:

    const [focusedIndex, setFocusedIndex] = useState(() => _.findIndex(flattenedSections.allOptions, (option) => option.keyForList === initiallyFocusedOptionKey));

    To:

        const [focusedIndex, setFocusedIndex] = useState(() => {
            const initialIndex = _.findIndex(flattenedSections.allOptions, (option) => option.keyForList === initiallyFocusedOptionKey);
            return initialIndex !== -1 ? initialIndex : 0;
        });

    Result:

    focus_index_selectionList.mp4

    Optional:

    1. We can pass initiallyFocusedOptionKey if we don't want to change the fallback for focusedIndex. We will use the first item key in the options form initiallyFocusedOptionKey.
    2. We can introduce a new prop inside BaseSelectionList to highlight the first option only if the prop is true. We will set the fallback property based on that.
  9. DylanDylann commented on Jan 12, 2024

    @DylanDylann
    Contributor

    I think we should hold for #29080

  10. 68 remaining items

  11. lschurr commented on Mar 19, 2024

    @lschurr
    Contributor

    @aimane-chnaif - Should this be open to proposals externally? Is the original bug still happening?

  12. aimane-chnaif commented on Mar 19, 2024

    @aimane-chnaif
    Contributor
    1. Observe no workspace is highlighted

    This step is failing. First workspace is always highlighted

  13. aimane-chnaif commented on Mar 19, 2024

    @aimane-chnaif
    Contributor

    Expected Result:
    No workspace should be highlighted by default

    Actual Result:
    The first workspace becomes highlighted

    Should this be inverted?

  14. lschurr commented on Mar 19, 2024

    @lschurr
    Contributor
  15. aimane-chnaif commented on Mar 20, 2024

    @aimane-chnaif
    Contributor

    I am going to be OOO soon. Please assign new C+.

  16. removed their assignment
    on Mar 20, 2024
  17. dukenv0307 commented on Mar 20, 2024

    @dukenv0307
    Contributor

    @lschurr I'm a new C+ so I'm low on issues, I can take over 👍

  18. lschurr commented on Mar 20, 2024

    @lschurr
    Contributor

    Based on the Slack thread, I think we're going to ask QA to test again. @lanitochka17 can you confirm this bug is still reproducible?

  19. lschurr commented on Mar 25, 2024

    @lschurr
    Contributor
  20. kavimuru commented on Mar 25, 2024

    @kavimuru

    @ishpaul777 bug is not rproducible

    bandicam.2024-03-25.18-47-35-654.mp4
  21. lschurr commented on Mar 25, 2024

    @lschurr
    Contributor

    Closing since we're unable to reproduce.

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

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2EngineeringInternalRequires API changes or must be handled by Expensify staff

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions