this post was submitted on 12 Feb 2024
100 points (98.1% liked)

Programming

17326 readers
231 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities [email protected]



founded 1 year ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 28 points 8 months ago (2 children)

Toggles should not exist. They should be check boxes. Checked if "ON", unchecked if "OFF" with a mouse over tooltip if there is any chance that it's ambiguous.

[–] [email protected] 16 points 8 months ago (1 children)

@calcopiritus @starman
Buttons/switches trigger an immediate action, whereas checkboxes usually do not (such as on a settings page, where no changes are applied unless you click "save").

[–] [email protected] -4 points 8 months ago* (last edited 8 months ago) (1 children)

Never said nothing about a button. Toggles are just check boxes with a different aspect.

EDIT: the thread is actually about actual buttons. Maybe should've clicked on the link where it explains what he means by "toggle button".

[–] [email protected] 10 points 8 months ago (1 children)

This whole thread is about buttons

[–] [email protected] 4 points 8 months ago (2 children)

Toggle buttons are not normal buttons, they are toggles. Which have the same functionality as check boxes. They are a toggle between 2 states. The only difference is visual.

If they toggle more than 2 states, (like a discrete slider), it is the same as a drop-down menu.

Some widgets are the exact same as others, where the only difference is their visual representation.

[–] [email protected] 4 points 8 months ago* (last edited 8 months ago) (1 children)

Again you're talking about switches. The thread is about normal buttons which have 2 states (the example being given is a button which can be a play button or a pause button depending on the current state). Buttons aren't like check-boxes, switches are. A button triggers an event, check-boxes don't. e.g. on a settings page, you tick all the check-boxes you want first, then click on the Save (or Cancel) changes button - one event for multiple changes. You don't tick a check-box to start playing something, you press a play button (which in this case would then change into a pause button).

[–] [email protected] 3 points 8 months ago (1 children)

Yeah you're right. Didn't see it was a crosspost and infered from the title.

[–] [email protected] 3 points 8 months ago

That's ok. Thanks for being big enough to admit you were wrong - these days a lot of people aren't!

[–] [email protected] 2 points 8 months ago

In my opinion, any button in terms of graphical UI design simply dispatches an action with no arguments regarding state. There doesn't exist a dichotomy between a "toggle" mechanic and a "standard" button as far as the button itself is concerned.

Whether or not you want to update the visual representation of that button is a separate concern.

[–] [email protected] 11 points 8 months ago (2 children)

The case that undermines your point is icon toggles, since they don't need a label, but a checkbox does. For example, dark mode icon buttons: They usually show sun or moon icons, which hits OP's point: if your in dark mode, and the button shows a moon, that would make sense -- except the button doesn't put you into dark mode, at that point it puts you into light mode, so, shouldn't it show the sun?

[–] [email protected] 1 points 8 months ago (1 children)

In the specific case of a dark mode, it doesn't matter since the whole aspect of the app changes. You could not label the individual states and it'd be fine.

Also, as soon as you add another theme it does no longer work, for a theme selector you need a drop-down selector which lists all the themes.

[–] [email protected] 1 points 8 months ago

That's true, you can't really miss what's happening with a dark mode switch -- it's not like it's a "charge me $50 extra for insurance on my shredded wheat" button.

The theme selector tho -- while rare -- IDK, that doesn't have have text -- it probably should, for the same if a11y, but you can indicate the theme with an image; the one I made for a project recently uses the image itself on the button.