搜索 | 用户支持

防范以用户支持为名的诈骗。我们绝对不会要求您拨打电话或发送短信,及提供任何个人信息。请使用“举报滥用”选项报告涉及违规的行为。

详细了解

HTML 5 Form Verification Issue | Missing information alert bubble doesn't stick to failing field

more options

As the subject line reads, I am experiencing the alert bubble not sticking to the failing input field while building a site using HTML5 and testing it on FireFox v78.0.2 (64-bit). Specifically, when I submit the form while leaving an input field empty, the browser will catch the required field as being empty and will stick the alert bubble to the field; however, when you scroll away from the failing field, the bubble does not stick to the field, but sticks instead to the top of the browser window.

I am using simple "required" tags for input fields in the form. On every other browser I have tried (Chrome, Edge, Brave) this issue does not exist.

Thanks for any help that you can provide.

As the subject line reads, I am experiencing the alert bubble not sticking to the failing input field while building a site using HTML5 and testing it on FireFox v78.0.2 (64-bit). Specifically, when I submit the form while leaving an input field empty, the browser will catch the required field as being empty and will stick the alert bubble to the field; however, when you scroll away from the failing field, the bubble does not stick to the field, but sticks instead to the top of the browser window. I am using simple "required" tags for input fields in the form. On every other browser I have tried (Chrome, Edge, Brave) this issue does not exist. Thanks for any help that you can provide.

所有回复 (4)

more options

Hi David, I can see the problem occurs with the example on MDN as well:

https://developer.mozilla.org/docs/Web/HTML/Attributes/required#Example

I don't know whether there is already a bug on file for this but if you start filing a new one, the site will check that:

https://bugzilla.mozilla.org/

more options

It seems to be a case of this bug:

[e10s] HTML5 validation popup doesn't close when the form element scrolls

I would say not to expect a fix in the next several months as it has only an average priority and severity ranking. Sorry about that.

more options

This does appear to be the bug. Looks like we will be exploring other form validation methods in the meantime. Thanks for the reply.

more options

You might explore using :invalid. https://developer.mozilla.org/docs/Web/CSS/:invalid

In addition to field coloring, if you have hints next to your fields, you could use a sibling selector to toggle them:

  input:invalid ~ .hint {
      display: inline;
  }
  input:valid ~ .hint {
      display: none;
  }