Can't get default sort for CMS Sort upon page load working

Hey @marc! Have you tried using a select field as your sort UI?

Here is an example of how to do this but do let me know if you have any issues.

In the meantime I’ll try to find a solution for the dropdown opening

Here is the code I have at the moment, I removed the button from the page and the (A-Z) option is working correctly but the dropdown stays open

<script>
  window.fsAttributes = window.fsAttributes || [];
  window.fsAttributes.push([
    'cmssort',
    (listInstances) => {
      console.log('cmssort Successfully loaded!');

      const dropdown = document.querySelector('.dropdown.w-dropdown');
      const optionToSelect = dropdown.querySelector('[fs-cmssort-field="name"]');
      optionToSelect.click();
    },
  ]);
</script>