Show a section id in the omnibox when a modal opens

I’d like to create a section id for a modal when a button is clicked, i.e.

somesite.com/#some-id

with the #some-id in the url when the modal is opened.

Beating my head against the wall. I did try to write a function but am struggling with this kind of site builder.

<script>
  document.addEventListener('click'), function(e) {
    if(e.target.matches('.some-class') || !e.target.closest('.some-menu'));
  }
  
  function openModal() {
    document.querySelector('.someButtonClass').style.display = ''
  }
</script>

Here is my site Read-Only: LINK