Link hash code is not safe and generates exception
The code referenced here generates an error and is not a good implementation. For example, we have some SPA code that uses hash links to trigger pages/overlays. We have for example a link like this:
<a href="#/country-selector" class="country-selector__select-link"> Shipping to <span class="country-selector__selected-country js-country-selector-selected-country">United States</span>. <span class="country-selector__edit">EDIT</span> </a>
That href is a valid hash/href, but if you feed that to your code, it throws a DOMException
document.querySelector('#/country-selector')
https://github.com/Shopify/theme-scripts/blob/db93486d37ed151c7661634d10d55069c0b80d61/packages/theme-a11y/theme-a11y.js#L91
@niedfelj, please open a PR with a proposed change.