Actually I'm inclined to say that https://github.com/projectblacklight/blacklight/blob/master/app/helpers/blacklight/blacklight_helper_behavior.rb#L171 should be using this approach (or something similar).

My concern was for those that aren't using ID as their unique key.  But, the document_heading currently uses that logic, so this code should as well.  I'll fix it.