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

♻️ (tooltip) refactoring to react-aria (vol.3) #2631

Merged
merged 17 commits into from
May 7, 2024

Conversation

MatissJanis
Copy link
Member

Follow up to #2493

This refactors the autocompletes, date selects and the "filters" menu.

@trafico-bot trafico-bot bot added the 🔍 Ready for Review Pull Request is not reviewed yet label Apr 18, 2024
Copy link

netlify bot commented Apr 18, 2024

Deploy Preview for actualbudget ready!

Name Link
🔨 Latest commit f6e2a55
🔍 Latest deploy log https://app.netlify.com/sites/actualbudget/deploys/6638fb90fc74bc00083760b8
😎 Deploy Preview https://deploy-preview-2631.demo.actualbudget.org
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Contributor

github-actions bot commented Apr 18, 2024

Bundle Stats — desktop-client

Hey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle.

As this PR is updated, I'll keep you updated on how the bundle size is impacted.

Total

Files count Total bundle size % Changed
9 4.7 MB → 4.7 MB (+1.64 kB) +0.03%
Changeset
File Δ Size
src/components/common/Popover.tsx 📈 +421 B (+148.76%) 283 B → 704 B
src/components/filters/FilterExpression.tsx 📈 +435 B (+17.03%) 2.49 kB → 2.92 kB
src/components/filters/SavedFilterMenuButton.tsx 📈 +421 B (+9.30%) 4.42 kB → 4.83 kB
node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js 📈 +58 B (+5.46%) 1.04 kB → 1.09 kB
src/components/filters/FiltersMenu.jsx 📈 +334 B (+2.70%) 12.07 kB → 12.4 kB
src/components/autocomplete/Autocomplete.tsx 📈 +270 B (+1.66%) 15.91 kB → 16.17 kB
src/components/select/DateSelect.tsx 📈 +92 B (+1.06%) 8.44 kB → 8.53 kB
src/components/LoggedInUser.tsx 📈 +2 B (+0.08%) 2.57 kB → 2.58 kB
src/components/autocomplete/CategoryAutocomplete.tsx 📈 +6 B (+0.06%) 9.21 kB → 9.21 kB
src/components/accounts/AccountSyncCheck.jsx 📈 +2 B (+0.04%) 4.39 kB → 4.4 kB
src/components/sidebar/Sidebar.tsx 📈 +2 B (+0.03%) 5.9 kB → 5.9 kB
src/components/Titlebar.tsx 📈 +2 B (+0.02%) 11.58 kB → 11.58 kB
node_modules/@reach/listbox/dist/reach-listbox.mjs 📉 -22 B (-0.05%) 40.54 kB → 40.52 kB
node_modules/@reach/popover/dist/reach-popover.mjs 📉 -4 B (-0.05%) 7.16 kB → 7.15 kB
node_modules/@xstate/fsm/es/index.js 📉 -32 B (-0.94%) 3.31 kB → 3.28 kB
src/components/filters/NameFilter.tsx 📉 -23 B (-1.12%) 2.01 kB → 1.99 kB
node_modules/react-is/cjs/react-is.production.min.js 📉 -54 B (-1.94%) 2.71 kB → 2.66 kB
src/components/filters/FilterMenu.tsx 📉 -228 B (-15.12%) 1.47 kB → 1.25 kB
View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

Asset File Size % Changed
static/js/AppliedFilters.js 20.41 kB → 21.16 kB (+769 B) +3.68%
static/js/index.js 2.99 MB → 2.99 MB (+743 B) +0.02%
static/js/wide.js 263.53 kB → 263.7 kB (+170 B) +0.06%

Smaller

No assets were smaller

Unchanged

Asset File Size % Changed
static/js/indexeddb-main-thread-worker-e59fee74.js 13.5 kB 0%
static/js/resize-observer.js 18.37 kB 0%
static/js/BackgroundImage.js 122.29 kB 0%
static/js/narrow.js 59.7 kB 0%
static/js/usePreviewTransactions.js 790 B 0%
static/js/ReportRouter.js 1.22 MB 0%

Copy link
Contributor

github-actions bot commented Apr 18, 2024

Bundle Stats — loot-core

Hey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle.

As this PR is updated, I'll keep you updated on how the bundle size is impacted.

Total

Files count Total bundle size % Changed
1 1.2 MB 0%

Changeset

No files were changed

View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

No assets were bigger

Smaller

No assets were smaller

Unchanged

Asset File Size % Changed
kcab.worker.js 1.2 MB 0%

@MatissJanis MatissJanis changed the title ♻️ (tooltip) refactoring to react-aria (vol.3) [WIP] ♻️ (tooltip) refactoring to react-aria (vol.3) Apr 18, 2024
@trafico-bot trafico-bot bot added the 🚧 WIP Still work-in-progress, please don't review and don't merge label Apr 18, 2024
@MatissJanis MatissJanis marked this pull request as ready for review April 18, 2024 20:39
@trafico-bot trafico-bot bot removed the 🔍 Ready for Review Pull Request is not reviewed yet label Apr 18, 2024
@MatissJanis MatissJanis changed the title [WIP] ♻️ (tooltip) refactoring to react-aria (vol.3) ♻️ (tooltip) refactoring to react-aria (vol.3) Apr 22, 2024
@trafico-bot trafico-bot bot added 🔍 Ready for Review Pull Request is not reviewed yet and removed 🚧 WIP Still work-in-progress, please don't review and don't merge labels Apr 22, 2024
@MatissJanis
Copy link
Member Author

MatissJanis commented Apr 22, 2024

Out for review now.

The VRT update is unrelated to this PR. VRT is currently failing in master branch.

@joel-jeremy
Copy link
Contributor

Would it be possible to retain the old scrollbars?

Old (Demo link):
image
image
image

New (This PR):
image
image
image

Observations:

  • Fliters: The popovers are not closing when autocomplete popovers are open and you click outside

@MatissJanis
Copy link
Member Author

Scrollbar: I pushed a change. Does the scrollbars work as expected now? Totally agree with you that we need to get this patched before merging this PR. But sadly I'm not able to reproduce on OSX, so fixing it is very challenging.

Fliters: The popovers are not closing when autocomplete popovers are open and you click outside

This one's tricky and I think we need to make a decision here on whether we proceed with the migration to react-aria or we roll back the changes. I don't think we'll be able to make it 1:1 match our current experience with react-aria.

Here's my investigation:

When we use stacked popovers (filters popover + autocomplete) - only the topmost popover can be closed when clicking on the outside. This is also assuming none of the popovers use the isNonModal prop. So best case scenario: closing the filter popover would require 2x clicks on outside (1x click would close autocomplete and 1x closes the filter menu).

However, we do want to use isNonModal for autocompletes. isNonModal makes sure than an "underlay" is not added to the page. The underlay intercepts clicks outside the popover context in order to close it. It also kills the target clicks. For example: if you clicked on a button while the underlay was active - the underlay would intercept the button click and thus the button would NOT be clicked.

isNonModal is important for transactions table where a user can click on the next row - this should immediately open the next row for editing and close the current.

So to sum it up: we have to decide if we wish to proceed with the migration given the functional change that you discovered. Clicking outside the filters menu while the autocomplete is open does not close the filter menu. WDYT?

@joel-jeremy
Copy link
Contributor

The scroll bars are all good now!

closing the filter popover would require 2x clicks on outside (1x click would close autocomplete and 1x closes the filter menu).

I'm good with this change in behavior. I just noticed something weird when the filter auto complete is open. When I click outside the filter popover, the auto complete popover won't close - it just returns focus to the auto complete input field. Only when click on the sidebar then that's when it closes.

@youngcw
Copy link
Contributor

youngcw commented Apr 26, 2024

Im still getting the basic scroll bars in Brave on Linux. Firefox is working though

@MatissJanis
Copy link
Member Author

Im still getting the basic scroll bars in Brave on Linux. Firefox is working though

Could you help me out here and submit a commit for the fix here? Normally I'd be happy to work on it, but I have only OSX :/

@shall0pass
Copy link
Contributor

Are the scrollbar's appearance supposed to be unchanged from the current demo?
I'm getting this on Edge (Windows 10):
image

And on Chrome (Windows 10):
image

@youngcw
Copy link
Contributor

youngcw commented Apr 26, 2024

Are the scrollbar's appearance supposed to be unchanged from the current demo? I'm getting this on Edge (Windows 10): image

And on Chrome (Windows 10): image

They are supposed to not change, but are currently stuck trying to figure out what the problem is

@youngcw
Copy link
Contributor

youngcw commented Apr 27, 2024

Ive been poking around this scrollbar issue. I get this error in the console. I tried changing the property name like it suggests, but nothing changed other than the error went away.

Error
Warning: Unsupported style property & ::-webkit-scrollbar. Did you mean & ::WebkitScrollbar?
    at div
    at $9bf71ea28793e738$export$20e40289641fbbb6 (http://localhost:3001/node_modules/.vite/deps/chunk-DIVEDOFX.js?v=dac6d417:1657:9)
    at $f1ab8c75478c6f73$export$cf75428e0b9ed1ea (http://localhost:3001/node_modules/.vite/deps/chunk-DIVEDOFX.js?v=dac6d417:740:54)
    at $337b884510726a0d$export$c6fdb837b070b4ff (http://localhost:3001/node_modules/.vite/deps/react-aria-components.js?v=dac6d417:4591:61)
    at $07b14b47974efb58$var$PopoverInner (http://localhost:3001/node_modules/.vite/deps/react-aria-components.js?v=dac6d417:23083:47)
    at $07b14b47974efb58$var$Popover (http://localhost:3001/node_modules/.vite/deps/react-aria-components.js?v=dac6d417:23055:64)
    at Popover (http://localhost:3001/src/components/common/Popover.tsx?t=1714242015775:12:27)
    at div
    at Downshift3 (http://localhost:3001/node_modules/.vite/deps/downshift.js?v=dac6d417:597:26)
    at SingleAutocomplete (http://localhost:3001/src/components/autocomplete/Autocomplete.tsx?t=1714242015775:138:31)
    at Autocomplete (http://localhost:3001/src/components/autocomplete/Autocomplete.tsx?t=1714242015775:598:35)
    at CategoryAutocomplete (http://localhost:3001/src/components/autocomplete/CategoryAutocomplete.tsx?t=1714242015775:116:40)
    at ConditionalPrivacyFilter (http://localhost:3001/src/components/PrivacyFilter.tsx:16:44)
    at div
    at _c (http://localhost:3001/src/components/common/View.tsx:17:13)
    at Cell (http://localhost:3001/src/components/table.tsx?t=1714242015775:110:24)
    at CustomCell (http://localhost:3001/src/components/table.tsx?t=1714242015775:373:37)
    at div
    at _c (http://localhost:3001/src/components/common/View.tsx:17:13)
    at Row (http://localhost:3001/src/components/table.tsx?t=1714242015775:218:23)
    at Transaction (http://localhost:3001/src/components/transactions/TransactionsTable.jsx?t=1714242015775:578:26)
    at div
    at _c (http://localhost:3001/src/components/common/View.tsx:17:13)
    at div
    at div
    at FixedSizeList (http://localhost:3001/src/components/FixedSizeList.tsx:26:9)
    at AvoidRefocusScrollProvider (http://localhost:3001/src/hooks/useProperFocus.tsx:40:46)
    at div
    at AutoSizer (http://localhost:3001/node_modules/.vite/deps/react-virtualized-auto-sizer.js?v=dac6d417:194:5)
    at div
    at _c (http://localhost:3001/src/components/common/View.tsx:17:13)
    at div
    at _c (http://localhost:3001/src/components/common/View.tsx:17:13)
    at http://localhost:3001/src/components/table.tsx?t=1714242015775:756:54
    at div
    at _c (http://localhost:3001/src/components/common/View.tsx:17:13)
    at div
    at _c (http://localhost:3001/src/components/common/View.tsx:17:13)
    at TransactionTableInner (http://localhost:3001/src/components/transactions/TransactionsTable.jsx?t=1714242015775:1411:34)
    at http://localhost:3001/src/components/transactions/TransactionsTable.jsx?t=1714242015775:1653:51
    at TransactionList (http://localhost:3001/src/components/transactions/TransactionList.jsx?t=1714242015775:53:35)
    at div
    at _c (http://localhost:3001/src/components/common/View.tsx:17:13)
    at div
    at _c (http://localhost:3001/src/components/common/View.tsx:17:13)
    at SelectedProvider (http://localhost:3001/src/hooks/useSelected.tsx:234:36)
    at SelectedProviderWithItems (http://localhost:3001/src/hooks/useSelected.tsx:291:45)
    at AllTransactions (http://localhost:3001/src/components/accounts/Account.jsx?t=1714242015775:120:28)
    at AccountInternal (http://localhost:3001/src/components/accounts/Account.jsx?t=1714242015775:212:9)
    at AccountHack (http://localhost:3001/src/components/accounts/Account.jsx?t=1714242015775:1554:50)
    at SplitsExpandedProvider (http://localhost:3001/src/hooks/useSplitsExpanded.jsx:25:42)
    at SchedulesProvider (http://localhost:3001/@fs/home/caleb/Desktop/actual/packages/loot-core/src/client/data-hooks/schedules.tsx:59:37)
    at Account (http://localhost:3001/src/components/accounts/Account.jsx?t=1714242015775:1575:20)
    at LoadComponentInner (http://localhost:3001/src/components/util/LoadComponent.tsx?t=1714242015775:33:31)
    at LoadComponent (http://localhost:3001/src/components/util/LoadComponent.tsx?t=1714242015775:23:14)
    at NarrowAlternate (http://localhost:3001/src/components/responsive/index.tsx?t=1714242015775:26:35)
    at RenderedRoute (http://localhost:3001/node_modules/.vite/deps/react-router-dom.js?v=dac6d417:3547:5)
    at Routes (http://localhost:3001/node_modules/.vite/deps/react-router-dom.js?v=dac6d417:3982:5)
    at div
    at div
    at _c (http://localhost:3001/src/components/common/View.tsx:17:13)
    at div
    at _c (http://localhost:3001/src/components/common/View.tsx:17:13)
    at div
    at _c (http://localhost:3001/src/components/common/View.tsx:17:13)
    at Router (http://localhost:3001/node_modules/.vite/deps/react-router-dom.js?v=dac6d417:3925:15)
    at BrowserRouter (http://localhost:3001/node_modules/.vite/deps/react-router-dom.js?v=dac6d417:4660:5)
    at FinancesAppWithoutContext (http://localhost:3001/src/components/FinancesApp.tsx?t=1714242015775:125:21)
    at ScrollProvider (http://localhost:3001/src/components/ScrollProvider.tsx:15:34)
    at DndProvider2 (http://localhost:3001/node_modules/.vite/deps/react-dnd.js?v=dac6d417:1329:9)
    at BudgetMonthCountProvider (http://localhost:3001/src/components/budget/BudgetMonthCountContext.tsx:14:44)
    at SidebarProvider (http://localhost:3001/src/components/sidebar/SidebarProvider.tsx:16:35)
    at TitlebarProvider (http://localhost:3001/src/components/Titlebar.tsx?t=1714242015775:49:36)
    at SpreadsheetProvider (http://localhost:3001/@fs/home/caleb/Desktop/actual/packages/loot-core/src/client/SpreadsheetProvider.tsx:118:39)
    at FinancesApp (http://localhost:3001/src/components/FinancesApp.tsx?t=1714242015775:521:17)
    at AppInner (http://localhost:3001/src/components/App.tsx?t=1714242015775:35:21)
    at ErrorBoundary (http://localhost:3001/node_modules/.vite/deps/react-error-boundary.js?v=dac6d417:18:5)
    at div
    at _c (http://localhost:3001/src/components/common/View.tsx:17:13)
    at div
    at _c (http://localhost:3001/src/components/common/View.tsx:17:13)
    at ResponsiveProvider (http://localhost:3001/src/ResponsiveProvider.tsx:24:7)
    at BoundHotkeysProxyProviderProvider (http://localhost:3001/node_modules/.vite/deps/react-hotkeys-hook.js?v=dac6d417:223:24)
    at HotkeysProvider2 (http://localhost:3001/node_modules/.vite/deps/react-hotkeys-hook.js?v=dac6d417:252:36)
    at App (http://localhost:3001/src/components/App.tsx?t=1714242015775:158:24)
    at ServerProvider (http://localhost:3001/src/components/ServerContext.tsx:41:34)
    at Provider (http://localhost:3001/node_modules/.vite/deps/react-redux.js?v=dac6d417:453:20)

@MatissJanis
Copy link
Member Author

Pushed a small update for the scrollbars. Let me know how it looks like now on your devices. 🤞

@youngcw
Copy link
Contributor

youngcw commented Apr 27, 2024

Its definitely better, but still not the same as before
image

@youngcw
Copy link
Contributor

youngcw commented Apr 28, 2024

Still the same. Interestingly, it works when in responsive mode, even when viewing the desktop style view.

@youngcw
Copy link
Contributor

youngcw commented Apr 29, 2024

The scrollbar on the budget page is broken now. I don't know when that started, or if its happening to anyone else. It doesn't happen in the demo, so its probably from this PR. As is the pattern, it looks fine in firefox. It's different than before, thinner than previous, but still looks fine.

@MatissJanis
Copy link
Member Author

Pushed an update. The scrollbar changes will now apply only to the new popovers. Which should make budget page work just as it did before.

Though I still don't have ideas how to reduce the scrollbar width to match the one we had before.

@youngcw
Copy link
Contributor

youngcw commented Apr 29, 2024

Ok, that fixed the budget page scrollbars

style={{
padding: 0,
...styles.darkScrollbar,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of putting this in a style prop, can we try using glamor to pass this to className? Maybe the inline style prop doesn't support pseudo selectors. Another possible option is to just use the scrollbarWidth and scrollColor css props instead of the darkScrollbar.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using glamor is a good idea! Updated it now, let me know how it looks!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It still is not working, we need to check that the darkScrollbar is set in the children's container element.

style={{
padding: 0,
...styles.darkScrollbar,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It still is not working, we need to check that the darkScrollbar is set in the children's container element.

}}
{...tooltipProps}
data-testid="autocomplete"
>
{renderItems(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can try wrapping this in a View and setting the scrollbar style there?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you be open to try this out locally? I'm working blindly here without a way to reproduce.

style={{ ...styles.tooltip, padding: 0, ...style }}
className={`${css({
...styles.tooltip,
...styles.lightScrollbar,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the old tooltip component defaults to using darkScrollbar

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, it did. But I think that was largely an unnoticed minor bug.

There are only 2x places where tooltips have scrollable content: autocomplete (where it makes sense to have darkScrollbar as the autocomplete is dark itself) and notes (where it makes more sense to have it light IMO).

@MatissJanis
Copy link
Member Author

@joel-jeremy @youngcw

What's the verdict here from you? Shall we proceed with the refactors to react-aria (which has some scrollbar changes) or would you prefer to roll-back the refactors already done (mostly just notes popovers)?

AFAIK the only blocker at this point is the scrollbar width change for MS/Linux devices (colors should be correct now?). If we decide to proceed with the migration - I'd create a separate issue to address the scrollbar widths and I'd hope on of yous could pick it up (as again: I do not have a way to reproduce the issue on Mac).

Let me know your thoughts.

@joel-jeremy
Copy link
Contributor

joel-jeremy commented May 6, 2024

@MatissJanis @youngcw Pushed an update for the scrollbar. Can you check?

The bulk edit modal styling is off:
image

@youngcw
Copy link
Contributor

youngcw commented May 6, 2024

The scroll bars are fixed for me now.

I am also seeing the overlap in the bulk edit modal

@MatissJanis
Copy link
Member Author

Thanks @joel-jeremy for figuring out the solution there!

Bulk edit modal should now be fixed.

@youngcw
Copy link
Contributor

youngcw commented May 6, 2024

Looks good to me

Copy link
Contributor

@joel-jeremy joel-jeremy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@trafico-bot trafico-bot bot added ✅ Approved Pull Request has been approved and can be merged and removed 🔍 Ready for Review Pull Request is not reviewed yet labels May 6, 2024
@MatissJanis
Copy link
Member Author

Thanks for all the help folks!

@MatissJanis MatissJanis merged commit f73f6c7 into master May 7, 2024
19 checks passed
@MatissJanis MatissJanis deleted the matiss/tooltip-filters branch May 7, 2024 16:18
@trafico-bot trafico-bot bot added ✨ Merged Pull Request has been merged successfully and removed ✅ Approved Pull Request has been approved and can be merged labels May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ Merged Pull Request has been merged successfully
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants