Drab.Modal.alert / Bootstrap 4 fails to close the box on "Cancel" button
guidotripaldi opened this issue · comments
After upgrading to Drab 0.9.2 and setting the config to Bootstrap4
config :drab, :modal_css, :bootstrap4
calling the Drab.Modal.alert/4
shows the box, but it responds only to OK and close (x) buttons, clicking on the CANCEL button it doesn't do anything
Drab.Modal.alert(socket, "Message", "Sure?", buttons: [ok: "OK", cancel: "CANCEL"])
Hi @guidotripaldi, thanks for reporting!
Unfortunatelly, I can's reproduce the issue?
By any chance, are you using the custom template for a cancel button? (file modal.alert.button.cancel.html.eex
)
Also, can you check if this https://github.com/grych/drab_example_bootstrap4 works? It is an empty app with BS4 and Drab installed.
yes, I have a custom template for the cancel button, it is defined this way:
<button id="_drab_modal_button_cancel" type="button" name="cancel" class="btn btn-outline-primary" data-dismiss="modal">
<%= label %>
</button>
I noticed only now that the problem depends by the lack of the class drab-modal-button
in my custom button definition, adding it makes the button "cancel" works again.
The documentation of Drab.Modal
states clearly that the custom button must have the drab-modal-button
class, but its is missed in the CHANGELOG.md
file, so when did my refactory after Drab upgrade I wasn't aware of it.
True, I have forgotten to mention that this is a breaking change for those having custom buttons already. Apologies.