Scroll highlight feature for workspace member page#38036
Scroll highlight feature for workspace member page#38036luacmartins merged 7 commits intoExpensify:mainfrom
Conversation
|
@ishpaul777 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
@ishpaul777 Scroll feature might misbehave as it is a known bug. |
|
@mountiny I am currently using fixed timing approach instead of focus till interaction as it is very hard to implement due to multiple extra re-renders which I am unable to control. |
| return; | ||
| } | ||
| const invitedEmails = Object.values(invitedEmailsToAccountIDsDraft).map(String); | ||
| selectionListRef.current?.scrollAndHighlightItem?.(invitedEmails, 1500); |
There was a problem hiding this comment.
We need to decide time here.
There was a problem hiding this comment.
@Expensify/design How long should the highlight be there for?
There was a problem hiding this comment.
Got it, so just to clarify, we are not doing the original idea where it stays highlighted until another action is taken? The highlight will always be ephemeral?
If that's the case I don't have strong feelings on an exact time... somewhere between 1.5-3 seconds seems fine to me?
There was a problem hiding this comment.
Got it, so just to clarify, we are not doing the original idea where it stays highlighted until another action is taken? The highlight will always be ephemeral?
@shawnborton We are using a fixed time approach only right now.
There was a problem hiding this comment.
Cool, no strong feelings in terms of time then - perhaps let's see some screen recordings of a few different options?
There was a problem hiding this comment.
1500ms (current)
Screen.Recording.2024-03-11.at.8.35.00.PM.mov
There was a problem hiding this comment.
That feels pretty good, but can we have the background color fade out instead of just change at the end?
There was a problem hiding this comment.
would be a great improvement, @shubham1206agra ^
There was a problem hiding this comment.
This will most probably be added later in a follow-up PR as discussed with @mountiny in Slack.
There was a problem hiding this comment.
smallll nitpick: 1500 should have been in CONST file
Could you define this problem a bit more specifically and bring it to slack, possible #newdot-performance and we could brainstorm with agency workers how to achieve this |
mountiny
left a comment
There was a problem hiding this comment.
@ishpaul777 @shubham1206agra Given this is bigger change to the BaseSelectionList component, can you please add tests for other places where the SelectionList component is used? Also make sure Tab+Enter navigation is working as expected there etc.
Thanks
| Keyboard.dismiss(); | ||
| // Please see https://github.com/Expensify/App/blob/main/README.md#Security for more details | ||
| Policy.addMembersToWorkspace(invitedEmailsToAccountIDsDraft ?? {}, welcomeNote ?? '', route.params.policyID); | ||
| Policy.setWorkspaceInviteMembersDraft(route.params.policyID, {}); |
There was a problem hiding this comment.
Noted in the other file, why did this need to be moved
There was a problem hiding this comment.
I think this is written in document. Its main purpose to get invite list when sending the invite request.
There was a problem hiding this comment.
I think we still want to clear this list, no?
|
I saw when I added new members, it re-renders with old members list, and then with new member list multiple times. And another problem I will highlight here, is that it might get laggy as I have to run highlight cleanup logic on every interaction which involves a Onyx cleanup logic, which might introduce performance issues. |
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2024-03-11.at.11.43.33.PM.movAndroid: mWeb ChromeScreen.Recording.2024-03-11.at.11.00.06.PM.moviOS: NativeScreen.Recording.2024-03-11.at.11.19.04.PM.moviOS: mWeb SafariScreen.Recording.2024-03-11.at.10.40.51.PM.movMacOS: Chrome / SafariScreen.Recording.2024-03-11.at.11.01.41.PM.movMacOS: DesktopScreen.Recording.2024-03-11.at.11.23.29.PM-1.mov |
|
Cool ok, I think we can leave the fade for later and explore if the highlight approach is doable |
| const scrollAndHighlightItem = useCallback( | ||
| (items: string[], timeout: number) => { | ||
| const newItemsToHighlight = new Set<string>(); | ||
| items.forEach((item) => { | ||
| newItemsToHighlight.add(item); | ||
| }); | ||
| const index = flattenedSections.allOptions.findIndex((option) => newItemsToHighlight.has(option.keyForList)); | ||
| updateAndScrollToFocusedIndex(index); | ||
| setItemToHighlight(newItemsToHighlight); | ||
|
|
||
| if (itemFocusTimeoutRef.current) { | ||
| clearTimeout(itemFocusTimeoutRef.current); | ||
| } | ||
|
|
||
| itemFocusTimeoutRef.current = setTimeout(() => { | ||
| setFocusedIndex(-1); | ||
| setItemToHighlight(null); | ||
| }, timeout); | ||
| }, | ||
| [flattenedSections.allOptions, updateAndScrollToFocusedIndex], | ||
| ); |
There was a problem hiding this comment.
Scroll feature might misbehave as it is a known bug.
just for future note that scroll just end above the item in list
Screen.Recording.2024-03-11.at.10.40.51.PM.mov
There was a problem hiding this comment.
Did this happen on mWeb only? Do we need to add an offset with the item height?
There was a problem hiding this comment.
This happens on all platforms.
|
@shubham1206agra can you resolve conflicts please? |
| const scrollAndHighlightItem = useCallback( | ||
| (items: string[], timeout: number) => { | ||
| const newItemsToHighlight = new Set<string>(); | ||
| items.forEach((item) => { | ||
| newItemsToHighlight.add(item); | ||
| }); | ||
| const index = flattenedSections.allOptions.findIndex((option) => newItemsToHighlight.has(option.keyForList)); | ||
| updateAndScrollToFocusedIndex(index); | ||
| setItemToHighlight(newItemsToHighlight); | ||
|
|
||
| if (itemFocusTimeoutRef.current) { | ||
| clearTimeout(itemFocusTimeoutRef.current); | ||
| } | ||
|
|
||
| itemFocusTimeoutRef.current = setTimeout(() => { | ||
| setFocusedIndex(-1); | ||
| setItemToHighlight(null); | ||
| }, timeout); | ||
| }, | ||
| [flattenedSections.allOptions, updateAndScrollToFocusedIndex], | ||
| ); |
There was a problem hiding this comment.
Did this happen on mWeb only? Do we need to add an offset with the item height?
| Keyboard.dismiss(); | ||
| // Please see https://github.com/Expensify/App/blob/main/README.md#Security for more details | ||
| Policy.addMembersToWorkspace(invitedEmailsToAccountIDsDraft ?? {}, welcomeNote ?? '', route.params.policyID); | ||
| Policy.setWorkspaceInviteMembersDraft(route.params.policyID, {}); |
There was a problem hiding this comment.
I think we still want to clear this list, no?
|
LGTM we can look at this issue in the follow up - #38036 (comment) |
|
Waiting for conflicts resolution |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/luacmartins in version: 1.4.52-0 🚀
|
|
🚀 Deployed to production by https://github.com/Beamanator in version: 1.4.52-6 🚀
|
Details
Fixed Issues
$ #35717
Tests
Offline tests
Same as Tests
QA Steps
Same as Tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel so the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Screen.Recording.2024-03-11.at.7.09.25.PM.mov
Android: mWeb Chrome
Screen.Recording.2024-03-11.at.6.44.06.PM.mov
iOS: Native
iOS: mWeb Safari
Screen.Recording.2024-03-11.at.6.27.11.PM.mov
Screen.Recording.2024-03-11.at.6.28.29.PM.mov
MacOS: Chrome / Safari
Screen.Recording.2024-03-11.at.6.12.58.PM.mov
MacOS: Desktop
Screen.Recording.2024-03-11.at.6.51.18.PM.mov