简体   繁体   English

在FireFox中关闭模式时显示所需的工具提示

[英]Required tooltip displayed when close modal in FireFox

Got a strange issue, I am developing an angularJS app that is to use Firefox only but I have an issue with the tooltip on a modal if the user clicks the Close button. 遇到了一个奇怪的问题,我正在开发一个仅使用Firefox的angularJS应用,但是如果用户单击“ Close按钮,我的模态提示会出现问题。

When the modal opens there is a dropdown list which is blank by default and is also required. 模态打开时,会有一个下拉列表,默认情况下为空白,也是必需的。 The modal also has a Submit button and Close button. 该模态还具有“ Submit按钮和“ Close按钮。 The Submit button is disabled until all mandatory fields are completed and the Close button is always enabled. 在完成所有必填字段并且始终启用“ Close按钮之前,将禁用“ Submit按钮。

If you click the Close button without selecting an option (which is a valid action) the modal closes as expected but the required tooltip is displayed. 如果单击“ Close按钮而未选择任何选项(这是有效操作),则模式将按预期方式关闭,但会显示所需的工具提示。

Does anyone know of a fix for this issue? 有谁知道解决此问题的方法?

Since the sample code is not exist, based on your question I tried a solution with the "Submit" and "Close" buttons. 由于示例代码不存在,因此根据您的问题,我尝试使用“提交”和“关闭”按钮进行解决。

Whatever the button you clicks, it fires the submit's function. 无论您单击什么按钮,都会触发提交功能。 So you need to block the execution by using $event.preventDefault(); 因此,您需要使用$event.preventDefault();阻止执行$event.preventDefault();

Sample HTML 范例HTML

<form name="form" novalidate ng-submit="saveModal()">
  <div class="row">
    <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
        <button class="btn btn-success" type="submit">
            <span>Submit</span>
        </button>
        <button class="btn btn-default" ng-click="closeModal($event)">
            <span>Close</span>
        </button>
    </div>
  </div>
</form>

Sample Controller 样品控制器

$scope.closeModal= function ($event) {
    $event.preventDefault();
    // Close modal related codes here
};

$scope.saveModal = function() {
    // I assume that the required tooltip related codes are available 
    // inside the submit's function
};

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM