It's because the hand joker card there allows straights and flushes to be made with 4 cards, so the 4 black suited cards make a flush, and the gapped sequence makes a straight, since both hands are made together it counts as straight flush. You can ignore the ace. It can get weirder because you can make a 4 card straight and toss another card unrelated but with the same suit as 3 of the straight cards and it still counts as straight flush.
In fact, since we already have a straight with the first 4 cards, we can replace that 7 with any other black card and still have a straight flush. Can even be a 2nd Jack.