My 2017 Macbook Pro space bar quit working. I read on this site that maybe it just need cleaning. So I tried that. When I tried to put the plastic cover back on it wouldn’t click into place. Ended up putting a little piece of sticky paper over the dot that is the sensor and scotch taped the plastic cover back on. Worked fine.
Went to Mac store today and had one of those experiences that make me consider switching back to a pc.
They said that the whole key board and top and battery would have to be replaced. But since I broke the par , it wasn’t covered under warranty or Applecare. I pointed out that it was already broken and that’s why I tried to clean it. Didn’t matter. So beware of any home attempts to fix.