Skip to content
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

[HOLD for payment 2024-12-09] [$125] Make sure the first result in most recents is highlighted when user uses CMD+K #51894

Closed
JmillsExpensify opened this issue Nov 1, 2024 · 35 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@JmillsExpensify
Copy link

JmillsExpensify commented Nov 1, 2024

From the design doc.

Recent chats is the same as our existing CMD+K command, which means:

  • The router can be opened and focused via the same keyboard shortcut
  • When CMD+K is pressed and no search has been entered, the top-most result in Recent chats is highlighted. Hitting the return key closes the router and navigates a member to the corresponding report

CleanShot 2024-11-01 at 19 44 45@2x

cc @luacmartins

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021852421610290735954
  • Upwork Job ID: 1852421610290735954
  • Last Price Increase: 2024-11-01
  • Automatic offers:
    • nyomanjyotisa | Contributor | 104805899
Issue OwnerCurrent Issue Owner: @JmillsExpensify
@JmillsExpensify JmillsExpensify added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Nov 1, 2024
@JmillsExpensify JmillsExpensify self-assigned this Nov 1, 2024
@melvin-bot melvin-bot bot changed the title Make sure the first result in most recents is highlighted when user uses CMD+K [$250] Make sure the first result in most recents is highlighted when user uses CMD+K Nov 1, 2024
Copy link

melvin-bot bot commented Nov 1, 2024

Job added to Upwork: https://www.upwork.com/jobs/~021852421610290735954

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Nov 1, 2024
Copy link

melvin-bot bot commented Nov 1, 2024

Current assignee @JmillsExpensify is eligible for the Bug assigner, not assigning anyone new.

Copy link

melvin-bot bot commented Nov 1, 2024

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

@luacmartins luacmartins self-assigned this Nov 1, 2024
@luacmartins luacmartins changed the title [$250] Make sure the first result in most recents is highlighted when user uses CMD+K [$125] Make sure the first result in most recents is highlighted when user uses CMD+K Nov 1, 2024
Copy link

melvin-bot bot commented Nov 1, 2024

Upwork job price has been updated to $125

@FitseTLT
Copy link
Contributor

FitseTLT commented Nov 1, 2024

Proposal

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

Make sure the first result in most recents is highlighted when user uses CMD+K

What is the root cause of that problem?

Improvement

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

We should save the first chat index here

sections.push({title: translate('search.recentChats'), data: styledRecentReports});

    const initiallyFocusedOptionKey = styledRecentReports.at(0)?.keyForList;

we will pass it here


Additionally: From the OP I can see that the list is not suppose to scrolled to the focused item on initial render but we have a code here that scroll to the focused index
scrollToIndex(focusedIndex, false);

we will disable this code by passing a new param shouldNotScrollToFocusedIndex

What alternative solutions did you explore? (Optional)

@HusseinSamy
Copy link

HusseinSamy commented Nov 2, 2024

Proposal

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

Make sure the first result in most recents is highlighted when user uses CMD+K

What is the root cause of that problem?

I don't know if the above proposal states the same issue or not, but for me; the issue is the lack of adding the initiallyFocusedOptionKey prop to the <SelectionList/> component.

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

  • Adding initiallyFocusedOptionKey={recentReports && recentReports.length > 0 ? recentReports.at(0)?.keyForList : ''} prop after the onArrowFocus prop will make sure that the first chat will be focused in recent chats if there are any.

What alternative solutions did you explore? (Optional)

Copy link

melvin-bot bot commented Nov 2, 2024

📣 @HusseinSamy! 📣
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:

  1. Make sure you've read and understood the contributing guidelines.
  2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
    Screen Shot 2022-11-16 at 4 42 54 PM
    Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

@HusseinSamy
Copy link

Contributor details
Your Expensify account email: [email protected]
Upwork Profile Link: https://www.upwork.com/freelancers/~01dd32e60eb083d581

Copy link

melvin-bot bot commented Nov 2, 2024

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

@deking254
Copy link

Contributor details
Your Expensify account email: [email protected]
Upwork Profile Link: https://www.upwork.com/freelancers/~0139a3178534697447

Copy link

melvin-bot bot commented Nov 3, 2024

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

@samranahm
Copy link

samranahm commented Nov 3, 2024

Proposal

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

Make sure the first result in most recents is highlighted when user uses CMD+K

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

The lack of an initiallyFocusedOptionKey to set the default focused item within the <SelectionList> component causes the list to open without any item pre-highlighted.

To ensure the first chat in the recent chats list is automatically highlighted when the search bar opens with CMD+K, we will:

  1. Add a variable, initiallyFocusedOptionKey, set to the key of the first recent chat.
  2. Pass this variable as a prop to the <SelectionList> component, enabling automatic highlighting.

sections.push({title: translate('search.recentChats'), data: styledRecentReports});

const initiallyFocusedOptionKey = styledRecentReports.at(0)?.keyForList;

and we will pass initiallyFocusedOptionKey to <SelectionList>

initiallyFocusedOptionKey={initiallyFocusedOptionKey}

What alternative solutions did you explore? (Optional)

Contributor details
Your Expensify account email: [email protected]
Upwork Profile Link: https://www.upwork.com/freelancers/~017a4e9874f15ccbd9

@melvin-bot melvin-bot bot added the Overdue label Nov 3, 2024
Copy link

melvin-bot bot commented Nov 3, 2024

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

Copy link
Contributor

github-actions bot commented Nov 3, 2024

@samranahm Your proposal will be dismissed because you did not follow the proposal template.

@nyomanjyotisa
Copy link
Contributor

nyomanjyotisa commented Nov 4, 2024

Edited by proposal-police: This proposal was edited at 2024-11-04 10:01:40 UTC.

Proposal

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

Make sure the first result in most recents is highlighted when user uses CMD+K

What is the root cause of that problem?

Changes request

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

All proposals above not working if we reload the page and directly press CMD+K, also not working if the user remove the search term. So I propose the following:

Create a new function called setInitialFocus here, and calculated the initialFocusIndex base on sortedRecentSearches and contextualReportData

    const setInitialFocus = useCallback(() => {
        const initialFocusIndex = sortedRecentSearches?.slice(0, 5).length + (contextualReportData ? 1 : 0);
        listRef.current?.setFocusedIndex(initialFocusIndex);
        listRef.current?.scrollToIndex(0, false);
    }, [sortedRecentSearches, contextualReportData]);

Call it in useEffect

    useEffect(() => {
        setInitialFocus();
    }, [sortedRecentSearches]);

And on onSearchChange, if newUserQuery false

} else {
listRef.current?.updateAndScrollToFocusedIndex(-1);
}

            } else {
                setInitialFocus();
            }

POC

-1-New-Expensify.30.mp4

What alternative solutions did you explore? (Optional)

Copy link

melvin-bot bot commented Nov 4, 2024

@JmillsExpensify, @Pujan92, @luacmartins Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

1 similar comment
Copy link

melvin-bot bot commented Nov 5, 2024

@JmillsExpensify, @Pujan92, @luacmartins Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@luacmartins
Copy link
Contributor

@Pujan92 did you get a chance to look at the proposals above?

@JmillsExpensify
Copy link
Author

Yes, let's please prioritize this one. It's coming up actively with our members.

@Pujan92
Copy link
Contributor

Pujan92 commented Nov 7, 2024

Sorry for the delay, I will review the proposals today.

Copy link

melvin-bot bot commented Nov 11, 2024

@JmillsExpensify, @Pujan92, @luacmartins, @nyomanjyotisa Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@melvin-bot melvin-bot bot added the Overdue label Nov 11, 2024
Copy link

melvin-bot bot commented Nov 13, 2024

@JmillsExpensify, @Pujan92, @luacmartins, @nyomanjyotisa Eep! 4 days overdue now. Issues have feelings too...

@JmillsExpensify
Copy link
Author

PR is being worked on. Hopefully up for review this week.

@JmillsExpensify JmillsExpensify added Weekly KSv2 and removed Daily KSv2 labels Nov 13, 2024
@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Overdue Weekly KSv2 labels Nov 13, 2024
Copy link

melvin-bot bot commented Dec 2, 2024

⚠️ Looks like this issue was linked to a Deploy Blocker here

If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

If a regression has occurred and you are the assigned CM follow the instructions here.

If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Dec 2, 2024
@melvin-bot melvin-bot bot changed the title [$125] Make sure the first result in most recents is highlighted when user uses CMD+K [HOLD for payment 2024-12-09] [$125] Make sure the first result in most recents is highlighted when user uses CMD+K Dec 2, 2024
Copy link

melvin-bot bot commented Dec 2, 2024

Reviewing label has been removed, please complete the "BugZero Checklist".

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Dec 2, 2024
Copy link

melvin-bot bot commented Dec 2, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.69-4 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2024-12-09. 🎊

For reference, here are some details about the assignees on this issue:

Copy link

melvin-bot bot commented Dec 2, 2024

@Pujan92 @JmillsExpensify @Pujan92 The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

@melvin-bot melvin-bot bot added Daily KSv2 Overdue and removed Weekly KSv2 labels Dec 9, 2024
@JmillsExpensify
Copy link
Author

Payment summary:

@melvin-bot melvin-bot bot removed the Overdue label Dec 9, 2024
@JmillsExpensify
Copy link
Author

Contributor paid via NewDot. @Pujan92 do you mind filling out the BZ checklist and recommending a regression test?

@Pujan92
Copy link
Contributor

Pujan92 commented Dec 9, 2024

I think we don't need a checklist here as this is a new change and not a bug.

Regression Test Proposal

  1. Navigate to search with CMD+K or click on the search icon for larger screens
  2. Verify that the top-most result in Recent chats is highlighted
  3. Press enter and verify that the user navigated to the highlighted Recent chats

@JmillsExpensify
Copy link
Author

Thanks regression test created. Please submit a request via New Expensify. Closing this issue out!

@garrettmknight
Copy link
Contributor

$125 approved for @Pujan92

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

9 participants