Skip to content

[$250] Attachment - Wrong video playback speed is highlighted #42425

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.74.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: N/A
Issue reported by: Applause - Internal Team

Issue found when executing https://github.com/Expensify/Expensify/issues/383873

Action Performed:

  1. Log in with any account
  2. Open any chat or room
  3. Upload a video attachment
  4. Play the video
  5. Click on the "..." button
  6. Click on the "Playback speed" button
  7. Change the speed
  8. Click on the "Playback speed" button again

Expected Result:

The current playback speed should be highlighted

Actual Result:

Wrong video playback speed is highlighted. There is no highlight on Android and iOS app

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

Bug6486124_1716205749562.bandicam_2024-05-20_13-36-09-159.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01bf77b70eb73d8074
  • Upwork Job ID: 1793174201872076800
  • Last Price Increase: 2024-06-26
  • Automatic offers:
    • Krishna2323 | Contributor | 102998073
Issue OwnerCurrent Issue Owner: @abdulrahuman5196

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on May 21, 2024
  2. melvin-bot commented on May 21, 2024

    @melvin-bot

    Triggered auto assignment to @JmillsExpensify (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. lanitochka17 commented on May 21, 2024

    @lanitochka17
    Author

    @JmillsExpensify FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

  4. lanitochka17 commented on May 21, 2024

    @lanitochka17
    Author

    We think that this bug might be related to #vip-vsp

  5. Krishna2323 commented on May 21, 2024

    @Krishna2323
    Contributor

    Proposal

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

    Attachment - Wrong video playback speed is highlighted

    What is the root cause of that problem?

    The focused index in not updated correctly when currentMenuItems gets changed and isSelected isn't passed in subMenuItems option.

    const selectItem = (index: number) => {
    const selectedItem = currentMenuItems[index];
    if (selectedItem?.subMenuItems) {
    setCurrentMenuItems([...selectedItem.subMenuItems]);
    setEnteredSubMenuIndexes([...enteredSubMenuIndexes, index]);
    } else {
    selectedItemIndex.current = index;
    onItemSelected(selectedItem, index);
    }
    };

    subMenuItems: CONST.VIDEO_PLAYER.PLAYBACK_SPEEDS.map((speed) => ({
    icon: currentPlaybackSpeed === speed ? Expensicons.Checkmark : undefined,
    text: speed.toString(),
    onSelected: () => {
    updatePlaybackSpeed(speed);
    },
    shouldPutLeftPaddingWhenNoIcon: true,
    })),

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

    1. Pass isSelected property in subMenuItems option.
    isSelected: currentPlaybackSpeed === speed,
    
    1. Update selectItem function to update the focused index whenever currentMenuItems gets changed.
        const selectItem = (index: number) => {
            const selectedItem = currentMenuItems[index];
            if (selectedItem?.subMenuItems) {
                const selectedItemIndexH = selectedItem?.subMenuItems.findIndex((option) => option.isSelected);
                setCurrentMenuItems([...selectedItem.subMenuItems]);
                setEnteredSubMenuIndexes([...enteredSubMenuIndexes, index]);
                setFocusedIndex(selectedItemIndexH);
            } else {
                selectedItemIndex.current = index;
                onItemSelected(selectedItem, index);
            }
        };

    What alternative solutions did you explore? (Optional)

    We can use useEffect to update the focused index.

        useEffect(() => {
            setFocusedIndex(-1);
            const selectedItemIndexH = currentMenuItems.findIndex((option) => option.isSelected);
            setFocusedIndex(selectedItemIndexH ?? -1);
        }, [currentMenuItems, setFocusedIndex]);

    Alternative solution 2

    If we don't want to highlight the selected option then we can just call setFocusedIndex(-1); inside selectItem callback.

    const selectItem = (index: number) => {
    const selectedItem = currentMenuItems[index];
    if (selectedItem?.subMenuItems) {
    setCurrentMenuItems([...selectedItem.subMenuItems]);
    setEnteredSubMenuIndexes([...enteredSubMenuIndexes, index]);
    } else {
    selectedItemIndex.current = index;
    onItemSelected(selectedItem, index);
    }
    };

    We already clear the index when selecting the option by pressing enter.

    if (focusedIndex === -1) {
    return;
    }
    selectItem(focusedIndex);
    setFocusedIndex(-1); // Reset the focusedIndex on selecting any menu

  6. tienifr commented on May 22, 2024

    @tienifr
    Contributor

    Proposal

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

    Wrong video playback speed is highlighted. There is no highlight on Android and iOS app

    What is the root cause of that problem?

    • When we are in Download | Playback speed menu, click on Playback speed option will set the focused index to 1 in here.

    • Then, the Playback speed menu opens. In here, the focused index is still 1 as we set before, leads to the current bug.

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

    • We need to set onMouseDown={(e)=>e.preventDefault()} in here. We already have this logic in a lot of logics, such as here to prevent app from focusing on the mouse down option.

    • We can also create a prop named shouldPreventDefaultFocusOnSelectRow to just apply the change e.preventDefault() if shouldPreventDefaultFocusOnSelectRow: true

    What alternative solutions did you explore? (Optional)

    NA

  7. JmillsExpensify commented on May 22, 2024

    @JmillsExpensify
    Contributor

    Opening up to the community.

  8. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on May 22, 2024
  9. melvin-bot commented on May 22, 2024

    @melvin-bot
  10. changed the title [-]Attachment - Wrong video playback speed is highlighted[/-] [+][$250] Attachment - Wrong video playback speed is highlighted[/+] on May 22, 2024
  11. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on May 22, 2024
  12. melvin-bot commented on May 22, 2024

    @melvin-bot

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

  13. 51 remaining items

  14. Krishna2323 commented on Jul 6, 2024

    @Krishna2323
    Contributor

    @allroundexperts PR ready for review ^

  15. Krishna2323 commented on Jul 14, 2024

    @Krishna2323
    Contributor

    @JmillsExpensify, PR was deployed to production 4 days ago, can you please update the title? Thanks

  16. Krishna2323 commented on Jul 23, 2024

    @Krishna2323
    Contributor

    @JmillsExpensify, payments due date was 17th July, could you please process the payments? Thanks

  17. Krishna2323 commented on Aug 5, 2024

    @Krishna2323
    Contributor

    @allroundexperts, can you please bump @JmillsExpensify for payments in slack 🙏🏻

  18. Krishna2323 commented on Aug 9, 2024

    @Krishna2323
    Contributor
  19. allroundexperts commented on Aug 11, 2024

    @allroundexperts
    Contributor

    Hi @Krishna2323!

    I have messaged @JmillsExpensify. Thanks for your patience. Someone from the team should be handling this soon.

  20. allroundexperts commented on Aug 11, 2024

    @allroundexperts
    Contributor

    Checklist

    1. Video player #30829
    2. https://github.com/Expensify/App/pull/30829/files#r1713070836
    3. N/A
    4. A checklist would be helpful here.

    Regression test

    1. Open any chat or room
    2. Upload a video attachment
    3. Play the video
    4. Click on the "..." button
    5. Click on the "Playback speed" button
    6. Verify that the first option is highlighted
    7. Change the speed
    8. Click on the "..." button
    9. Click on the "Playback speed" button again
    10. Verify the selected speed is highlighted

    Do we 👍 or 👎 ?

  21. JmillsExpensify commented on Aug 12, 2024

    @JmillsExpensify
    Contributor

    @Krishna2323 All paid out. Always feel free to reach out to me via Slack if you don't see a response here.

  22. JmillsExpensify commented on Aug 12, 2024

    @JmillsExpensify
    Contributor

    Payment summary:

  23. melvin-bot commented on Sep 4, 2024

    @melvin-bot

    This issue has not been updated in over 15 days. @JmillsExpensify, @cristipaval, @allroundexperts, @Krishna2323 eroding to Monthly issue.

    P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!

  24. trjExpensify commented on Oct 4, 2024

    @trjExpensify
    Contributor

    ^^ Payment summary here confirmed is good.

  25. JmillsExpensify commented on Oct 4, 2024

    @JmillsExpensify
    Contributor

    $250 approved for @allroundexperts

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.ExternalAdded to denote the issue can be worked on by a contributorMonthlyKSv2ReviewingHas a PR in review

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions