mstdn.social is one of the many independent Mastodon servers you can use to participate in the fediverse.
A general-purpose Mastodon server with a 500 character limit. All languages are welcome.

Administered by:

Server stats:

16K
active users

Rosita

Tried to build a darkmode button in JavaScript, and it Works! 😃

But only once😞

You'll have to refresh the page to switch back. And really don't know how to resolve this.

🐤 Maybe its because I have two buttons?

@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

@cwilcox808 @amarok It works! I deployed it on the darkmode branch. I still need to take a look to aria-pressed = false and focus and inert. But it works (for now)😃

rosita311.github.io/RulesbyRos

rosita311.github.ioHome

@heybran @amarok

Thanks for the tip! It works! I deployed it on the darkmode branch. I still need to take a look to aria-pressed = false and focus and inert. But it works (for now)😃

rosita311.github.io/RulesbyRos

rosita311.github.ioHome