DEV Community


Discussion on: Car keys toggle it right !

dmail profile image
Damien Maillard Author

I see, but for me toggle does not translates the user intent correctly.

I think a user would phrase his intent like this:
"I want to mute" or "I want to unmute". Not "I want to toggle mute"

Once you need to describe user action in an object (for redux, tracking, whatever) it becomes clear for me: I would not describe the action using "toggle mute" because it is dependent of the state, it does not translates the intent correctly. I would rather use "mute" or "unmute" to clearly describes what user wanted at that point.

I think exposing a toggleMute function is exposing a way to misinterpret the caller intent.

jayjeckel profile image
Jay Jeckel

Sure, but when you get down to actually designing the GUI, the mute/unmute control is going to be a single button. When that button is clicked it is going to toggle the state. Even if your library doesn't provide a toggleMute method, that is the logic that will be used in the button click handler.

Again, I agree with your overall point, not every boolean state semantically represents a toggle, but mute as it is used does represent a togglable state.

Forem Open with the Forem app