
Apple Mail randomly becomes the frontmost application in macOS - dewey
https://annoying.technology/posts/cd82d56f98e75afc/
======
vladharbuz
I've had this issue for the past 2–3 years. It seems to happen because of
improper error handling. If you look closely at the app in the instant it
opens, your affected account will have a “disconnected” symbol next to it in
the sidebar. However, it goes away before an error can be shown.

My theory is: there is a momentary connection issue with these G Suite
accounts, and Mail.app starts to show an error by focusing itself, but the
error is resolved so quickly it doesn't actually get to show the “connection
problems” modal.

I hope this can be fixed soon, it's been a daily annoyance for me for a long
time now.

~~~
evanelias
In my experience, if you always hide the Mail window (cmd-h) instead of
closing it (cmd-w), it won't ever pop back up. Takes a while to retrain the
muscle memory though!

I haven't tested this in Catalina, but it definitely works consistently in
Mojave.

~~~
derefr
Mind you, a program with “hidden” windows open takes up more CPU/memory than a
program without any windows open, because the view-controllers for those
windows are still running, just bound to an invisible, non-updating view.
(Though, admittedly, it’s less of a CPU cost than _minimizing_ the window,
since that requires the view to be kept active too, to facilitate updating the
live thumbnail.)

The main place this comes up is in cases where the main window is doing
something clever to gather the information to display itself. For example,
Activity Monitor doesn’t suddenly stop using half your CPU when you hide it.

Mail.app probably keeps a big scrollable list-control for the selected view
in-memory for as long as you have the window open. So it might be a bad idea
to do this if you’re one of those people who never archive anything (i.e.
practice “Inbox Infinity.”)

~~~
saagarjha
> Though, admittedly, it’s less of a CPU cost than minimizing the window,
> since that requires the view to be kept active too, to facilitate updating
> the live thumbnail.

I thought that was a static thumbnail?

> For example, Activity Monitor doesn’t suddenly stop using half your CPU when
> you hide it.

It does for me, which is why I keep it hidden when I’m not actively using it.

~~~
derefr
> I thought that was a static thumbnail?

Nah, it updates (...as far as I can recall.) Try opening a chat client,
minimizing the chat window, and then sending a message from another device to
yourself.

I believe it’s just using the same call into the compositor that Mission
Control uses to display your windows and spaces. Those are all live. (They
might have a lower update rate, though.)

> It does for me, which is why I keep it hidden when I’m not actively using
> it.

Interesting. This might be down to Activity Monitor being written to respond
to a message letting it know that its view is entirely obscured, and the
Activity Monitor main-window view-controller deciding in response that there’s
no point in it polling the system if all it’s going to do when re-visible is
discard all the stuff it learned in the mean time and re-poll again to get the
newest data for the view.

I can’t recall whether Activity Monitor has any historical/time-series views
built in? If it does, then if you hide Activity Monitor with those active, it
_should_ keep using CPU, to gather the data for that view, whether it’s
rendering it or not.

------
lapcatsoftware
My workaround for this issue is to put Mail app in its own dedicated
Space/Desktop. Then it only comes to the front in its own Space, not in the
Space I'm normally using.

~~~
nextos
I've switched back to a new MacBook, temporarily due to COVID as it was easy
to purchase from Apple and it was an emergency.

I used OS X fulltime 2006-11. I'm surprised how buggy Catalina is, including
Mail.app. I have had serious firmware issues too, such as needing to reset my
SMC very frequently because my USB C stops charging the machine every other
day. Apple is clearly, sadly, neglecting mac OS.

Surprisingly, I haven't disliked butterfly keys as much as I thought I would
do. I can type extremely fast. I do prefer their scissor keys, though, which
are really good and low latency [1].

[1] [https://danluu.com/keyboard-latency/](https://danluu.com/keyboard-
latency/)

~~~
mgkimsal
if you really got a brand new one, the keyboard may not be as bad as the
previous iterations (2016/2017)

~~~
nextos
Yes, it's new and it's fairly decent. I love mechanical keyboards (especially
those with ALPS and TOPRE switches), but I realize low travel means I type
much faster and it doesn't tire my fingers.

IMHO the scissor keys in the Magic Keyboard are really good because they
strike a perfect compromise in terms of depth, comfort and speed. Also the
board is really low latency. Not sure what tricks Apple has played with the
firmware in those keyboards.

------
jtlowe
I experience this as well after upgrading to Catalina. I thought it was my
fault at first, caused by some sort of key combo. It only happens for me when
in full screen with another app.

I use Mail with a GSuite account as well.

~~~
mihaaly
I am still not on Catalina yet and it started for me ca. 6-9 months ago.
Perhaps with some Mojave update. (unsure as no big changes occurred and it
took some time to see being a systematic trouble)

I am more and more turning off system updates (not only Mac) as those bring
more trouble than good. Being a very late adopter pays off. (update to
Catalina is still not in the middle term plans)

~~~
IAmEveryone
To add a datapoint that might be underrepresented for reasons of self-
selections: I've updated to Catalina and haven't had any issues.

------
holstvoogd
Pretty sure it is due too it not being able to connect to a mail server. every
time it happens, i see the "couldn't connect" icon

~~~
galad87
Yes, that's it. It happened with my Gmail account too, it stopped when I
removed it from Mail.

------
auggierose
Yeah, it is horrible. I am closing Apple Mail when I am not using it because
of it.

------
7ewis
Something I still don't understand, similar to this - not sure if it's a bug
or feature but I use Desktops heavily, especially while working at home
without my extra monitors.

For some reason, the order of my Desktops on Mac seem to reshuffle, I can't
work out what causes it or when it happens. I often have it ordered something
like this:

Desktop 1 - Google Doc (Chrome)

Desktop 2 - Researching (Chrome)

Desktop 3 - Slack

Desktop 4 - Spotify

I'll do the three finger gesture moving from Desktop 1 to 2 and randomly say
Spotify will have moved there. It's so annoying.

~~~
theDoug
The answer is found in System Preferences > Mission Control. Uncheck the
“Automatically rearrange spaces based on most recent use” box :)

~~~
jonpurdy
Astounding to me that automatic rearranging would have been considered
desirable. Hard to imagine that it’s just visual folks (like myself) who would
lose flow state if the mental map of their Desktops was interrupted if they
were suddenly rearranged.

~~~
gumby
> Astounding to me that automatic rearranging would have been considered
> desirable

Funny, i really like this because it lets me switch to another app and then
return with a single swipe. The ipad has this behaviour too though the swipe
is in the opposite direction.

I use full screen very heavily and rarely use spaces as separate desktops,
which _I_ find weird. You probably consider my use weird.

Not to say one approach is better than the other, just suggesting whoever set
the default might have decided based on their own use. I suspect this issue
was not subjected to any UX research, even at a place as big as apple.

~~~
jonpurdy
You're likely correct: it feels like it wasn't subjected to any UX research.
Knowing how Apple works, it was probably demoed in front of a few higher-ups,
but nobody other than the person or team writing it used the feature long
enough to notice that some people would be confused by it.

And you're correct, I never use full screen. I don't think it's weird to use
it, it just doesn't suit my workflow (single large monitor, so I need a lot of
stuff side-by-side).

------
mstade
I don't have any issues with Apple Mail but I do have issues with zoom,
randomly switching from full screen sharing to the desktop and back again,
it's incredibly annoying. It doesn't happen when I share my screen, only when
others do. It seems to have gotten better recently but still happens in
occasion. Anyone else seeing this? Maybe it's related?

~~~
vladnyc
It’s a setting you can turn off

~~~
snazz
Yes. This is a very annoying default, but luckily you can disable it.

~~~
mstade
Alright people, stop teasing and tell me what to look for please! :o)

~~~
blueberry_47
Settings > Share Screen > Maximize Zoom window when a participant shares
screen ?

------
brandonhorst
You can fix this by removing the “Google” account and connecting to Gmail as a
regular IMAP account.

Since I did that, I haven’t had any issues with this.

~~~
nottorp
Oh, I was wondering why I don't have that issue. I've set up Apple Mail long
before they had specific support for "google" accounts so of course the gmail
account is imap...

Btw 7 years of importing application configuration across OS installs without
a hitch.

------
rinaldsarins
I have the same issue, in fact I'm so used to it that I even do not notice it
anymore, except when watching fullscreen video, then I'm like: "It's just the
way how things are here...[quits Mail]".

As someone already mentioned - I'm also pretty sure it's related to some
disconnect/reconnect thing.

------
threeseed
Please make sure to log this at
[http://bugreporter.apple.com](http://bugreporter.apple.com)

Your bug will at least then be triaged and acknowledged.

~~~
chrisseaton
> Your bug will at least then be triaged and acknowledged.

Lol sure it will.

~~~
threeseed
Bugreporter is just a front end for Radar.

And I can assure that when I was working at Apple bugs were triaged and
acknowledged by a PM. Doesn’t mean they get fixed though.

~~~
PunksATawnyFill
Radar’s asinine search functionality also obscures the seriousness of bugs by
failing to reveal dupes.

It doesn’t (or at least didn’t) default to searching for all words used in the
title; it only searches for the EXACT string you enter. It was a pain in the
ass to even find bugs YOU wrote.

I couldn’t believe how goddamned dumb this is, or the Radar team’s response:
Oh, you simply use Oracle syntax and wildcards in the title search! No
explanation of how we were supposed to know this, or WHY.

~~~
saagarjha
> Oh, you simply use Oracle syntax and wildcards in the title search!

TIL

------
Veen
This has been annoying me for months. It’s particularly irritating when you’re
screen sharing. I just make sure Mail is quit when I’m not using it, which
isn’t ideal.

------
kristofarkas
How is it that there is still no known root cause for this issue? I suspect
there is a way to check what the reason an app came to the foreground is, no?

~~~
galad87
The reason is that Mail thinks the mail server is unreachable, so it brings
the window to front, but then magically it changes idea and the mail server is
reachable again ️.

~~~
bambataa
In general I find macOS handles alerting the user very poorly.

I don't know why but it infuriates me when icons bounce on the dock for
attention. The animation is too insistent for whatever trivial thing the app
wants to let me know.

Or an app will open some Important Dialog Box that I need to deal with, except
it's hidden behind some other windows somewhere and the rest of the app
refuses to respond to my clicks until I find the dialog box. It doesn't bother
foregrounding the dialog box for me.

~~~
redler
Yeah, that's not good. Sometimes you can find it through some combination of
ensuring that app is frontmost by clicking its icon in the dock, choosing
"hide others" from its menu, and triggering "show application windows" in
Mission Control (often ctrl-down-arrow, or a three-finger down-swipe trackpad
gesture).

~~~
bambataa
Due to the explosion in videoconferencing I've spent some time recently
helping family set things up via remote desktop (I highly recommend Chrome
Remote Desktop by the way, pretty easy to set up). This kind of thing is
absolutely inscrutable to non-tech savvy people. All they see is that the
computer suddenly stops doing anything but playing an annoying "donk" sound
whenever they click and they have no idea that any of those features exist.

Really, Windows with its `window == app == taskbar item` approach is far
easier to understand.

------
knolan
I’ve had this issue for a long time now across a couple of versions of MacOS
and three Macs. It appears to be related to Google Calendar. My current
workaround is to hide a Mail window with CMD-h. I’ve given up trying to report
it or find a fix.

~~~
evanelias
Can confirm, same here. As long as you hide the window (cmd-h) instead of
closing it (cmd-w), the problem doesn't ever come up. I've been using this
work-around for over a year now.

------
gnicholas
Another Mail issue I have: if one mail message is highlighted and then I click
another and type command-R to reply, the email reply will be to the message
that is no longer selected. Sometimes I’ll get a notification of a new email,
go to click and send a quick reply (“ok great”), and I’ll have sent the email
before I realize that it’s going to the wrong recipient.

It seems crazy to me that the order of operations can be messed up like this.
First I clicked, then I command-R’d. Why would Mail handle these commands out
of order?

------
demarq
I switched to Airmail for only this reason lol

~~~
Nextgrid
Watch out.

Last time I tried it, it was vulnerable to a bunch of issues similar to XSS.

I suggest you test it with
[https://www.emailprivacytester.com/](https://www.emailprivacytester.com/) and
see if it still finds anything.

~~~
demarq
oh wow, thanks for the heads up!!

------
kahlonel
I was a long time Gmail user, on the verge of leaving Gmail due to a long list
of reasons. This bug was the final straw for me (I know it’s not Gmail’s
fault). Got rid of Gmail completely. Haven’t seen this bug since.

~~~
deergomoo
I’m not sure why but Google services seem to cause a lot of issues on the Mac.
I don’t use Google-based calendars anymore, but when I did, the accountsd
process would often sit chewing absurd amounts of CPU for no discernible
reason.

Same goes for this Mail issue, it only seems to happen with Gmail/G Suite
accounts.

But yes, I am also looking to move away from Gmail; not because of this bug
but because I don’t like the idea of all my important online accounts being
tied to a company that has essentially zero customer service or support.

------
saagarjha
Interestingly, I have the opposite problem: when I boot up my computer Mail
shows now windows until I click on it, even though every other app restores
its windows. Very strange.

------
egypturnash
I get something like this all the time, except it pops up behind whatever I'm
doing and doesn't steal focus. I also almost never do stuff in full screen
mode, maybe that's the trigger for it stealing focus?

Definitely seems to be related to "I had an email connectivity error and I
must let you know NOWNOWNOW." Knowing that it's associated with gmail accounts
feels like one more reason for me to get off my ass and disentangle my email
from gmail...

------
bondolo
If you have Microsoft Exchange accounts then you get a different bug. If you
have no network connection or change network connections Apple Mail will
thrash accountsd for long periods of time consuming as much of the CPU as it
can. Neither Apple Mail nor accountsd appear to have any throttling of network
connection attempts. Quitting Apple Mail until you have a network connection
is the only option.

------
underyx
I have this and it keeps happening while I'm playing Counter-Strike.
Incredibly annoying for it to split screen and steal focus from the game.

------
fsflyer
My Apple Mail bug is with changing passwords on Exchange accounts. I change
the password, Apple Mail prompts for the new password, then uses the old one
to connect.

I have to quit Apple Mail and use the accounts pane of preference panels and
cancel when it prompts for the new password as it has the same bug. Then I can
click details and change the password. That works.

Reported many years ago in Sierra.

------
ancarda
I get something like this with Music.app -- it seems to randomly open. I
suspect it's some kind of keystroke (i.e. hitting the play button) but I
haven't figured out exactly why it's happening or how to stop it.

I'm pretty sure this didn't used to happen until I upgraded to Catalina.

I really wish I had better luck with Linux...

~~~
1_player
If no media is currently playing or paused and you press the Play button by
mistake, the Music app opens. It's extremely annoying.

~~~
jedieaston
You can get rid of this with

launchctl unload -w /System/Library/LaunchAgents/com.apple.rcd.plist

([https://www.howtogeek.com/274345/stop-itunes-from-
launching-...](https://www.howtogeek.com/274345/stop-itunes-from-launching-
when-you-press-play-on-your-macs-keyboard/))

~~~
cytzol
Unfortunately, when I tried it, it made the media keys stop working entirely,
not _just_ stopping Music from opening.

------
kwood
It’s bizarre to me that nowadays an application can become frontmost
application at all. When I switched to OSX back in the days, it was an
advertised feature that this can’t happen the same way it does on Windows. If
something wants attention, its icon bounced in the dock. Nothing more.

------
apple4ever
I run into an issue that started the past few upgrades: Mail will just stop
downloading new Mail. No rhyme or reason, it just stops. I can have a second
computer next to it and watch mail come in, but on that Mail, it won't do
anything. I have to quit (sometimes force-quit) to get it to start again.

------
wadkar
Ugh! It’s most annoying when you’re in a full screen app and presenting.
Suddenly, Mail.app decides to take half the screen and spurts all my inbox for
everyone to see. You can’t watch full time videos either due to this
annoyance.

------
coldcode
Outlook 365 does this as well.

------
defnotashton2
Reading the people that put up with it why? What's wrong with thunderbird?

~~~
Synaesthesia
Mac Mail is a great app IMO. It's full featured and performant, I'm very happy
with it. This is pretty much the only issue, and it's only with Gmail.

------
hackandtrip
It happens A LOT with non-GSuite Gmail accounts (personal GMail accounts) too!

~~~
jeffbee
There's no reason why it shouldn't affect all google mail accounts equally. If
the cause is frontend disconnections, it will happen to any account tier.

------
marmaduke
I've encountered other features such as long

\- long press on send (i.e. you're thinking about it) will send all your
drafts

\- deleting an email might select the one above or below after, so you can't
rapid fire delete a sequence

------
gumby
This has been happening to me since 10.12 and I have no google account
connected to my machine for anything (mail, calendar, nothing). It’s
infuriating, and assumed it was some perverse design decision.

------
njhaveri
If anybody is interested, I've been writing a Gmail-focused email client for
macOS called Mimestream. It combines native macOS UI with Gmail-specific
features such as categorized inboxes, colored labels, and aliases (made
possible by the use of the Gmail API instead of IMAP).

I just opened up a public beta, and you can request immediate access on the
website at [https://mimestream.com](https://mimestream.com). It's free during
the beta period - I only ask for feedback: feedback@mimestream.com.

Unlike some other 3rd party email clients, it makes direct connections from
your Mac to Gmail and stores data/credentials on your Mac. There's no
intermediary servers.

------
lcnmrn
I keep it minimized to avoid the issue and to get notifications.

~~~
1_player
It still pops up when it's minimised. I blame this bug for my inboxes going to
crap over the past year, because the only fix for me is keeping Mail closed
and opening it only when I really need to.

------
rm445
I stopped using Mac Mail quite recently, because of a bug that meant not all
my IMAP folders were displayed.

Remember Mozilla Thunderbird? It's great. Also has an RSS reader built in.

------
aichi
This is happening to me on Catalina with Safari. Having on dual monitor
another app and Safari, clicking in another app and Safari takes focus back.

------
MindTooth
I have the problem that Mail.app gets the frontmost CPU-bound application. It
for no obvious reasons too.

All in all, a bit buggy application it seems.

------
amachefe
Added to this, have anybody been able to get Mail app to connect via
authenticated proxy?..

I can only use Outlook to work at work which is frustrating

------
m463
Apple mail also loads remote images when you forward an email, indepdent of
the "load remote images" setting.

(haven't tried latest OS)

------
jshaqaw
For years I’ve seen a concostent bug where I can’t go to the Mail window until
I force quit and reopen mail a bunch. Frustrating.

------
willmacdonald
I have a similar issue with Safari. I have not opened it for months, but every
so often it is the frontmost app after waking.

------
KenanSulayman
Funnily enough most of the times Mail came up was due to me accidentally
pressing cmd + i in a browser.

~~~
saagarjha
I hate that! I’ve been looking for ways to turn it off or rebind it to another
keyboard shortcut but it never sticks…

------
villgax
Just learnt to minimise(Ctrl+M) the window instead of closing it with x or
Ctrl+W

------
elmcrest
hits me too and it‘s really annoying... I even got used to quit Mail.app but
yeah... it‘s bad. My feeling though is that google is more and more saying
goodbye to standards... just a feeling

------
lupinglade
Hard to believe it still hasn’t been fixed.

------
baby
Same. I’ve had this issue for a while now.

------
maxcbc
I’ve had it since I got catalina

------
pretzel_boss
I thought I was going insane

------
ornornor
Apple Mail is riddled with bugs it’s unusable. Do yourself a favor and switch.
Anything else is better than it, Thunderbird is a pretty good alternative imo.

It feels like apple doesn’t put any care into regression bugs in their
applications. It’s the same on the iPhone, Mail is so bad that I uninstalled
it in favor of outlook (the irony...) —Mail was sucking so much battery that
my phone wouldn’t last 8h. With outlook it lasts all day (12+h)

~~~
st3fan
> Apple Mail is riddled with bugs it’s unusable.

Weird, I've been using it for a decade and I have zero issues. Maybe
'unusable' is a pretty subjective assessment?

~~~
lowwave
The best thing about Apple Mail is their integration with contacts and
everything "i" Phone, Pad, etc.

It is the whole ecosystem lock down deal again. Nothing has progressed in tech
in this aspect, each company is still for themselves instead of consumers.

~~~
st3fan
What lock down are you talking about? Any email client can integrate with your
calendar and contacts - those are public APIs.

------
someonehere
Where I work we don’t allow Apple Mail to run on corporate computers.

IT rolled out mandatory endpoint protection once, and they started getting
reports of malware living in the Mail storage folder. Apparently when
employees synced their corporate Gmail to Apple Mail, Apple Mail was pulling
down the malicious/suspicious attachments from the Google spam folder. So I
figure that’s a good reason why physical mail clients need to die. There’s no
real need for them anymore.

~~~
fiddlerwoaroof
Malware doesn’t harm your computer just by sitting around on the disk.

~~~
jojobas
Until someone finds a buffer overflow in Apple Mail MIME handling or some
such.

------
mihaaly
It is not a bug, it is a feature. Someone out there had to write the code that
pushes the mail app to the front. It does not happen spontaneously, someone
made it happen. And made it an exclusive behavior without user control. It
must have been a conscious feature. A mindless and stupid one, but still a
feature. No bug to fix here.

(after suffering and spending toooo much time of experimenting I decided to
get rid of the Google account approach of the Mac but use it as an IMAP
account, turning off 'safe' access in my Google account)

~~~
dewey
> Someone out there had to write the code that pushes the mail app to the
> front.

Sometimes the code you write doesn't do what you had in mind. Or worse: gets
triggered by side effects of something unrelated.

I don't think it's intentional in this case but even if it would be
intentional after seeing this many bug reports everywhere you'd have to
reconsider and make connection errors less intrusive.

~~~
mihaaly
You do not push the whole app to the front by mistake, especially at some
glitch of connection as it is happening here! It is not a typo or whatever
kind of mistake just happens on its own but had to be a conscious action!! I
write code, I make mistake, but this is beyond that! It is also neglected for
years now while being very widespread, no way of being unnoticed and left
there if it wasn't a conscious choice to do so!

