HP seems to have more keyboard issues then motherboard problems, especially within the last 5 years. It used to be motherboards when they got to 6-10 years old, but they seem to be more prone to keyboard failure these days - although you still see both. You didn’t explicitly say it’s an HP laptop, but the model number read as HP to me. The model number is Envy 17-J005TX. The service manual can be found here.
Most of the modern HP Consumer notebooks made since around 2014-2015 use a keyboard that is spot welded in with plastic posts and yours is no exception :-(. On these machines, you need to replace the palmrest since there is no reliable way to re-secure the keyboard to the plastic once broken off. However, yours seems to be the exception to the rule to the common design flaw HP has done on quite a few models over the years, but there’s a catch. In order to replace the keyboard, it requires a complete teardown but it is at least doable. Consider it a weekend project if you haven’t dealt with a design that’s DOA for repair design like this - you’ll need the time to get it right. This is not the first time they did something stupid and it won’t be the last on the Consumer side! The part that absolutely annoys me about it is they put this kind of bad design on consumer systems, yet they get it right on the Elite and Z series. I’m still okay with recommending HP Business hardware, but I’m also going to call them out for having poor serviceability on the HP Consumer machines.
The HP Spare# is in the manual, and you will need to figure out which one applies as each layout/country format is different. The best way to get it if you have the laptop open is to reference the bad keyboard, if possible. If not, narrow it down to the country your keyboard is from and have the standard and Leap Motion Spare# on hand so you know what you need after confirming the part by taking the laptop apart unless you know for sure on the Leap Motion issue. These keyboards may not interchange so you probably don’t want to try your luck unless you can confirm elsewhere you can use a Leap Motion keyboard on a non-Leap Motion system. It may not work the other way around, so bear that in mind.
With your machine being an HP, parts aren’t as easy to get as it is for me to get them for my used Dell systems. It’s not impossible, but it does require a little know-how on where to get them and HOW to search. Using the part# on the modern machines is usually enough because they’re still plentiful but for a older system, you often need additional information. This is new enough to just rely on the HP Spare# to find it.