Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Target attribute on menus breaks HTML validation #16340

Closed
sarahelsaig opened this issue Jun 18, 2024 · 3 comments · Fixed by #16341
Closed

Target attribute on menus breaks HTML validation #16340

sarahelsaig opened this issue Jun 18, 2024 · 3 comments · Fixed by #16341
Labels
Milestone

Comments

@sarahelsaig
Copy link
Contributor

Describe the bug

Since target attribute has been added to menu links (#15541) validation via html-validate fails. This is because if there is no target specified, it creates an empty attribute, like <a class="nav-link px-lg-3 py-3 py-lg-4" href="/" target="">Home</a>. This is not valid. If there is no target specified, the attribute should be omitted.

Note: according to MDN the default is target="_self" so falling back to that value is also acceptable when omitting the target attribute would be complicated.

Orchard Core version

Latest preview, at least TheBlogTheme package is affected.

Expected behavior

Menu should produce valid HTML.

Logs and screenshots

An example entry of the validation report:

{
  "ruleId": "attribute-allowed-values",
  "severity": 2,
  "message": "Attribute \"target\" has invalid value \"\"",
  "offset": 2331,
  "line": 55,
  "column": 6,
  "size": 1,
  "selector": "#navbarResponsive > ul > li:nth-child(2) > a",
  "ruleUrl": "https://html-validate.org/rules/attribute-allowed-values.html",
  "context": {
    "element": "a",
    "attribute": "target",
    "value": "",
    "allowed": {
      "enum": [
        {},
        "_blank",
        "_self",
        "_parent",
        "_top"
      ]
    }
  }
}
@hishamco
Copy link
Member

/cc @hyzx86

@hyzx86
Copy link
Contributor

hyzx86 commented Jun 18, 2024

@sarahelsaig Looks like we're duplicating our work~

@Piedone Piedone added this to the 2.0 milestone Jun 18, 2024
Copy link
Contributor

We triaged this issue and set the milestone according to the priority we think is appropriate (see the docs on how we triage and prioritize issues).

This indicates when the core team may start working on it. However, if you'd like to contribute, we'd warmly welcome you to do that anytime. See our guide on contributions here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants