There's an old online tool called ChordDisplay that handles these a bit better and also uses web midi as well. I think it's also open-source so you could probably take a look at the logic it uses as a reference point.
https://chord-display.rednet.io
My first exposure to realtime chord detection was actually on a old Yamaha arranger keyboard from the early 90s. When you are designating the chord for the instruments to follow using your left hand, the LCD display will show the chord in the progression.
EDIT: My bad, 7ths are working - I'm just used to inversions being expressed as slash chords!