4

In checkout what's the difference between these css classes on fields: required / _required ?

Because I see that some fields have _required css class, but the address field block has only required (without line character). And if I send the empty form, the address field block doesn't receives _error class (and not receiving the same error design).

Here's a screenshot:

enter image description here

Thanks in advance

Edit:

This is what the OP is referring to, some classes use required and others use _required. So what is the difference?

enter image description here

enter image description here

2
  • 1
    Could you please be a bit more clear as to what your issue is. Are you wanting to have a section of the form required?
    – Rebel
    Commented Mar 13, 2017 at 20:17
  • 1
    @Rebel I have updated the question with screenshots to show what the OP means.
    – Ben Crook
    Commented Dec 5, 2017 at 14:34

1 Answer 1

1

CSS classnames starting with an underscore are helper classes (e.g. ._active, ._open, ._expanded, ._hidden, ._required), all other classnames (should) start with a letter. According to the Magento 2 Developer Documentation some parts of the Magento code might not comply with this standard yet and therefore you might still find helper names without an underscore.

You must assign HTML helper classes in JavaScript to modify presentation layer.

HTML helper class names added in JavaScript REQUIRE underscore symbol (_) at the beginning and must be written in lowercase.

Right: <div class="tab-element _active">Content</div>

Wrong: <div class="tab-element active">Content</div>

Source: Magento 2 DevDocs / Code demarcation standard

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.