popbox.js icon indicating copy to clipboard operation
popbox.js copied to clipboard

Unable to toggle checkbox

Open premregmi opened this issue 6 years ago • 3 comments

This modal plugin is awesome but I am blocked with 1 issue. I can't toggle checkbox inside this popbox. If checked it can not be unchecked and if unchecked I can not make it checked.

<div class="popbox" data-popbox-id="manageGroupModalConfirm">
    <div class="popbox-content bg-white">
      <div class="modal-body">
        <input type="checkbox">
        <div class="custom-control custom-checkbox">
          <label class="custom-control-label" for="manageGroupDontShow">Don’t show this message again</label>
        </div>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-primary" data-popbox-close="manageGroupModalConfirm">Ok</button>
      </div>
    </div>
</div>

premregmi avatar Mar 20 '19 01:03 premregmi

I didn't get deep into it but removing e.preventDefault() from the source code (look at the code fragment below) should solve the problem.

....
popboxs[i].addEventListener('click', function(e){
    e.preventDefault();   // <-- remove this line
...

Naumov1889 avatar Jan 12 '20 19:01 Naumov1889

Technically they'd just have to check if e.currentTarget === popboxs[i] before calling preventDefault. Otherwise yeah, it basically nukes out of existence any click event inside the modal

Voltra avatar May 31 '23 13:05 Voltra

Checking e.defaultPrevented would be nice as well to have undesired click event processing

Voltra avatar May 31 '23 13:05 Voltra