@rulesbyrosita
I don't have a suggestion for your problem but have a different suggestion. Instead of changing the button name based on its state, give it a name like "Dark mode" and the attribute `aria-pressed="false"`. When dark mode is enabled, toggle the attribute to "true"; this will be more reliable and clear way to convert the state for screen reader users.
@amarok