Semantic-ui: [POPUP] Popup does not fit within the boundaries of the viewport

Created on 11 Sep 2015  路  8Comments  路  Source: Semantic-Org/Semantic-UI

if you do not have enough space for the popup appears this error, such as open console.

Usage Question

Most helpful comment

I think default error throwing when popup cannot fit is not correct from UX point of view.

All 8 comments

That's correct behavior. You can specify a lastResort position in settings object if you need it to appear always even if it cannot fit.

I think default error throwing when popup cannot fit is not correct from UX point of view.

@matikucharski +1

@matikucharski +1

That's definitely not what users expect.

Hello, I found a dirty workaround to make it shows and resizes accordingly of the window:

  • Add this to your CSS .ui.popup{overflow:auto;}
  • Add this to your JS:
var resizePopup = function(){$('.ui.popup').css('max-height', $(window).height());};

$(window).resize(function(e){
    resizePopup();
});
  • Initialize your popup:
$('.button')
    .popup({
        on: 'click',
        lastResort: 'bottom right',
        onShow: function(){
            resizePopup();
        },
    })
;

Cheers :)

@matikucharski +1 @Almaju +1

max-height can be set to 100vh instead.

use element children and set scroll and max-height into popup:
overflow-y: scroll; max-height: 400px;

Was this page helpful?
0 / 5 - 0 ratings