As mentioned, the large majority of 2023 Palestinians were not even of voting age in 2006, and Hamas didn't even win a majority (they had a plurality). That was 17 years ago. I don't think all Palestinians should be held responsible for the election then. But yes, Hamas did win an election at one point.