Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[switch] Should the switch have a toggle() method? #1046

Open
gfellerph opened this issue Apr 26, 2024 · 1 comment
Open

[switch] Should the switch have a toggle() method? #1046

gfellerph opened this issue Apr 26, 2024 · 1 comment

Comments

@gfellerph
Copy link
Contributor

Question in the explainer: https://open-ui.org/components/switch.explainer/#methods

Existing input elements don't have a toggle method. The value of checkboxes for example can be set trough the .value property in JavaScript. Switches only have two states and could easily be toggled. Should the switch support a .toggle method?

The proposed syntax for the toggle method would also allow for an optional force parameter:

mySwitch.toggle(): (force?: boolean) => boolean
@gregwhitworth gregwhitworth added the agenda+ Use this label if you'd like the topic to be added to the meeting agenda label Apr 30, 2024
@css-meeting-bot
Copy link

The Open UI Community Group just discussed [switch] Should the switch have a toggle() method?, and agreed to the following:

  • RESOLVED: input type="checkbox" switch will not have a toggle() method
The full IRC log of that discussion <bkardell_> q+
<masonf> q+
<brecht_dr> gregwhitworth: Should there be a toggle method on switch so that we can just call toggle, that changes the value
<gregwhitworth> ack bkardell_
<brecht_dr> bkardell_: This is for the input type variant. Do we still plan to do an element called switch? if so, is there support for that by vendors?
<brecht_dr> bkardell_: If this would apply to input, then i would like the answer to be "no", because input is already weird with all the variants, we shouldn't add more in my opinion.
<gregwhitworth> ack masonf
<brecht_dr> masonf: I had similar questions. I follow among the same lines. There is also a method called click, which is what you might want here
<Travis7> NICK Travis
<brecht_dr> masonf: I'd say let's just do that
<brecht_dr> gregwhitworth: I just wanted to call out that there isa toggle method (in chat meeting: https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/toggle)
<brecht_dr> gregwhitworth: I wonder what are we designing this for? That is the question
<bkardell_> sure... in an ideal world I would like a toggle on an element called switch
<brecht_dr> gregwhitworth: I'm in favour to say no for now, but this is an HTML centric decision
<gregwhitworth> q?
<gregwhitworth> Proposed Resolution: input type="checkbox" switch will not have a toggle() method
<masonf> +1
<bkardell_> +1
<brecht_dr> +1
<gregwhitworth> RESOLVED: input type="checkbox" switch will not have a toggle() method

@gregwhitworth gregwhitworth removed the agenda+ Use this label if you'd like the topic to be added to the meeting agenda label May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants