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

[Button] should toggle with state function #6323

Open
jcheron opened this issue Apr 6, 2018 · 12 comments
Open

[Button] should toggle with state function #6323

jcheron opened this issue Apr 6, 2018 · 12 comments
Milestone

Comments

@jcheron
Copy link

jcheron commented Apr 6, 2018

It seems that toggle button is broken since 2.3.1 version,
all was good for toggle buttons in 2.3.0

Steps

<a class="ui toggle button">Toggle</a>
<script>$(".ui.button.toggle").state();</script>

Expected Result

a toggle button...

Actual Result

Uncaught TypeError: $(...).state is not a function
    at HTMLDocument.<anonymous>

Version

Semantic ui 2.3.1 (cdnjs)
jQuery 3.3.1

Testcase

https://jsfiddle.net/jcheron/n90gcwjz/2/

Note

Version 2.3.1 available at https://semantic-ui.com/dist/semantic.min.js works, while cdn (cdnjs or cdn.jsdelivr.net) does not work.

The files are different!

@y0hami y0hami added this to the 2.3.x milestone Apr 7, 2018
@certainlysylvia
Copy link

In case the reason has not been resolved and for those who want an interim patch - this is because the 2.3.1 package does not have state.js and state.min.js files - just a build issue. I copied the files from 2.3.0 as a temp fix and yay all sorted.

@jcheron
Copy link
Author

jcheron commented Jun 23, 2018

The 2.3.2 package still does not include the state module which has disappeared since 2.3.1

This is unfortunate because semantic-ui is unusable via all cdns.
It is necessary to add the latest available version of state.js manually:

<script src="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.3.0/components/state.min.js"></script>

@topherfangio
Copy link

Hitting this too; would love a real solution.

@skwny
Copy link

skwny commented Jul 21, 2018

Having this problem as well.

@postbud
Copy link

postbud commented Jul 28, 2018

+1

2 similar comments
@AurielleP
Copy link

+1

@tomgallagher
Copy link

+1

jcheron added a commit to phpMv/ubiquity-devtools that referenced this issue Nov 19, 2018
@glashtin
Copy link

This is still an issue with 2.4.1, starting to feel like this project might be dead. I can not believe no one else uses toggle buttons and it has been left unresolved for this long.

@glashtin
Copy link

glashtin commented Dec 12, 2018

So since there i no longer a state.js in the components even I am not sure what there plan is for the future of the toggle button. I was able to come up with the following temp solution at least until they fix it or I find another component library.

Remove the startup call to

$(".ui.button.toggle").state();

doing this will not allow toggle buttons to work by default anymore but you can still do something like

//Button Code
$('#btnToggleButton').click(function () {
$('#btnToggleButton').removeClass('active');
//button press stuff, setting some variable that stores if it should be toggled or not
if (shouldBeToggled) {
$('#btnToggleButton').addClass('active');
}
});

I hope they fix this in the next version but if not I can at least still use the component for now using this code.

@lubber-de

This comment was marked as spam.

@MarJose123
Copy link

The state components is not also available on the 2.4.2 version

@lubber-de

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests