Yes, and it stinks.
When you file bankruptcy, you can surrender the home/condo/townhome back to the mortgage company. They will sell the home off, but if there is any deficiency, they cannot sue you for the difference.
HOA dues are a little different. If your name is still on the property after you file bankruptcy, then they can still bill you for ongoing HOA fees. Even worse, until the bank or a buyer titles the property back into someone else’s name, you will still be liable for those new HOA fees. This means that you may surrender a home in bankruptcy and still get sued a year later by the HOA.
Banks seem to understand this, and they will keep the property in your name for as long as they can (if the home is upside down with no potential buyers). Eventually, someone will buy the home and will have to pay all of those fees off at closing, but until that happens, you will still get billed by the HOA.