Bug: New and Edit buttons work only the first time in Sematic UI

Bug: New and Edit buttons work only the first time in Sematic UI

dtekdtek Posts: 2Questions: 1Answers: 0
edited April 2018 in Free community support

As you can see here, if you click the first time the New button the relative modal window opens up normally, but if you close it and try to open it again something is not right.
Same thing with the Edit button.

It seems to be because the second time it doesn't put the div.ui.modal created inside the existing div.ui.modals.

This question has an accepted answers - jump to answer

Answers

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    FWIW, it doesn't work for me either. (Chrome, if that matters.)

  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin
    edited April 2018 Answer ✓

    Thanks! I've actually got a fix for this already - in the editor.semanticui.js file, change this

            $(self._dom.modal)
                .appendTo( 'body' )
                .modal( 'setting', {
                    dimmerSettings: {
                        closable: false
                    },
                    onVisible: function () {
                        // Can only give elements focus when shown
                        if ( self._dte.s.setFocus ) {
                            self._dte.s.setFocus.focus();
                        }
     
                        if ( callback ) {
                            callback();
                        }
                    },
                    onHidden: function () {
                        $(append).append( appendChildren );
                        $(this).detach();
                        self._shown = false;
                    }
                } )
    

    block to be (two lines removed - that's it):

            $(self._dom.modal)
                .modal( 'setting', {
                    dimmerSettings: {
                        closable: false
                    },
                    onVisible: function () {
                        // Can only give elements focus when shown
                        if ( self._dte.s.setFocus ) {
                            self._dte.s.setFocus.focus();
                        }
     
                        if ( callback ) {
                            callback();
                        }
                    },
                    onHidden: function () {
                        $(append).append( appendChildren );
                        self._shown = false;
                    }
                } )
    

    Allan

  • dtekdtek Posts: 2Questions: 1Answers: 0

    Thank you, now it seems to work fine.

This discussion has been closed.