MetaMask / MetaMask/metamask-extension
MetaMask action view should default to showing a connected account for the current tab
- Dominant language
- TypeScript
- Stars
- 13.2k
- Forks
- 5.6k
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 451
Description
Inspired by the kind of confusion reported in issue #8956 and #8929
## Problem
- When a user re-visits a site with a non-connected account selected, previous version users expect the dapp to see their globally-selected account.
- We handle this gracefully when the user switches the account within MetaMask, by prompting to connect or dismiss.
- We do not provide indication when the user switches the account on a different site and then returns to the site with that different account selected.
## The Classic Suggestion
For long-time MetaMask users and developers, the obvious solution is to implement behavior that more closely resembles breaking the connection, so when user re-visits site A, they do not carry context from site B.
This can be achieved with a log-out button like #8990, or by recognizing when a user is returning with a non-enabled account selected, and acting "not logged in" in this context.
That issue was closed because of [a decent workaround](https://github.com/MetaMask/metamask-extension/issues/8990#issuecomment-658985565), but it doesn't change the case for old dapps that are not implementing this workaround, with old users who expect a single globally-selected account.
## The Version 8 Native Solution
There is another approach that I think is better in the long run, and it goes back to the original V8 designs, and an improvement that we cut from the first v8 release for the sake of shipping it sooner:
When clicking the MetaMask fox, you should always see a view that is contextual to the current site you are viewing.
This may be a list of the connected accounts, but at the bare minimum, it should be _a_ connected account.
This does not solve the problem of "users who expect a single globally connected account", which is our old behavior, and it's unfortunate that this means breaking an established expectation.
This does have a behavior that we believe is more intuitive to new users from web2, however: The MetaMask fox becomes like a login widget in the corner of any site, and it allows you to reference the account that is connected to that site.

We did not implement this behavior originally so that we could ship V8 a bit sooner, as it had some major changes that were otherwise blocking production, but now that it's out, this is a pretty clear improvement that was long part of the plan, so we just need to prioritize it appropriately.
Contributor guide
Research direction
Start by tracing the MetaMask fox action view and how the current tab's connected accounts are selected. Review the account-switching behavior described in the issue and related issues #8956, #8929, and #8990. Done means revisiting a site opens a contextual view showing at least one account connected to that site, with appropriate behavior when none is connected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100