Semantic-Org / Semantic-UI

Semantic is a UI component framework based around useful principles from natural language.
http://www.semantic-ui.com
MIT License
51.1k stars 4.94k forks source link

[Dropdown] "set active"/"remove active" and "set visible"/"remove visible" should do something #7046

Open havajsky opened 3 years ago

havajsky commented 3 years ago

Calling $(...).dropdown('set active') adds class 'active' to attributes of $(...) Calling $(...).dropdown('remove active') removes class 'active' from attributes of $(...)

Calling $(...).dropdown('set visible') adds class 'visible' to attributes of $(...) Calling $(...).dropdown('remove visible') removes class 'visible' from attributes of $(...)

The problem is that after calling $(...).dropdown() to activate there is no class 'active' in attributes of $(...) and no class 'active' in attributes of $(...) and the $(...) dropdown is active and visible. So adding these classes doesn't seem to do anything and removing doesn't seem to do anything either.

If they are supposed to change the behavior, it needs to be clearly explained in [Dropdown] "Behavior" https://semantic-ui.com/modules/dropdown.html#behavior. The second column of the bottom table needs to be detailed and explicit, e.g., Description of behavior "remove active" shouldn't just be "Removes dropdown active state" - we need to know exactly what the "active state" means. Will the dropdown not expand when clicked? Will the current selection be grayed? (An image would be great). This is general comment - describing behavior by repeating it's name is mostly inadequate.

Suggestion 1: Change the class names to "inactive" and "invisible" - this way if these classes do not need to be there by default and setting them - which is exceptional - changes the behavior.

Suggestion 1: Introduce class "disabled" with behaviors "set disabled" and "remove disabled". When dropdown is "disabled" than shows the "placeholder text" and clicking is has no effect. (Describe it this way.)

BTW. Suggestion: Add behavior "set placeholder text". Describe it by stating what "placeholder text" means, when it appears, why it may be useful.

Version 2.4.2