TouchBar buttons being auto-pressed when lid is closed

Marconelly

macrumors 6502
Original poster
Jul 5, 2008
390
222
About a month ago, I started noticing that my Xcode has been possessed. I would finish the work, close the lid on the MBP for the night, then next day when I would want to continue, I would notice every so often that Xcode is not at all the way I left it - it would jump to some totally different class (often times a system class that I know I wasn't looking at all), and bunch of lines of code would become commented-out, so I would have to undo the damage. In some cases, it seemed like even the system classes would have commented-out lines, and there were two times where I couldn't figure out what system classes were damaged, so I had to reinstall Xcode.

I double checked that I didn't have a bluetooth keyboard getting connected to the laptop, and doing random keypresses - it wasn't that. My only external BT keyboard was switched off completely, and didn't even have batteries in it.

After some time it dawned on me what was happening: TouchBar in Xcode has two buttons in the middle of the strip: One is to comment-out the code "//" and the other is to jump to a definition. Somehow, these two buttons were being pressed all on their own while the laptop lid is closed, and that would explain for all the nonsense that was happening. Since then, I've removed those buttons from the strip in Xcode, and sure enough, the problem has stopped. But still, I obviously don't want this happening. In the finder, I used to have a trashcan button on that spot in touchbar! It could be deleting the files from the folder I left it, without me ever knowing. I removed the potentially problematic buttons from everywhere I could think of - but how could something like this be happening in the first place? I tried resetting the PRAM and SMC btw, that didn't stop the problem. This doesn't seem like a known issue - I couldn't find anything anywhere about it, so I figured I'll ask about it here to see if anyone else has seen it, and to help others who potentially experience it. I'm clueless as to when exactly the buttons are being pressed or how. I know that touchbar turns off when the lid is closed. Maybe during the time capsule backup over the night, the machine wakes up, and this happens then? I wonder if Apple would cover this problem under their extended keyboard warranty that they apply to 2016 and 2017 MBP models? Of course, I'd have significant problems proving that the problem exists in the first place :\
 
Last edited:

PROFESS0R

macrumors 6502
Jul 30, 2017
252
225
I am guessing that this is not what is causing your problem, even though you think it is. First, the touchbar itself is lower than the actual keyboard. Assuming your screen does not have something covering it on just the lower half near the touchbar, there is no way the screen could contact the touchbar to cause it to do anything. Second, as you note, when the lid is closed, the touchbar and the keyboard are disabled. I suspect you have another issue going on.

Joe
 

Marconelly

macrumors 6502
Original poster
Jul 5, 2008
390
222
I admit I'm stupefied by it, and nothing really makes sense. But I did notice that ever since I removed those buttons from the touchbar, the problem has stopped. Last night I put them back, just for a test, and in the morning I noticed the problem again. Also, the problem seems to only happen if I leave the computer closed for several hours, and plugged in. So far I've never been able to make the problem happen by closing and opening it a few minutes later.
 

PROFESS0R

macrumors 6502
Jul 30, 2017
252
225
Try cleaning the touchbar with a mild soap and water or just water and wipe it down good. Maybe some sort of residual capacitance related to fingerprints and debris. Unlikely, but worth a quick test.