Skip to content

Pager shape HTML validation issue #17907

@wAsnk

Description

@wAsnk

Describe the bug

Running HTML validation on the Pager shape causes a validation error.

Orchard Core version

"OrchardCore.Application.Cms.Targets" Version="2.1.7"

To Reproduce

  1. Use pager shape in liquid (shape_pager)
  2. Previous link has no href, so the rel attribute is shown as an attribute misuse in HTML validation.

Expected behavior

Do not get HTML validation errors.

Logs and screenshots

E.g. using shape_pager in a liquid shape:

error: "rel" attribute cannot be used on <a> in this context: requires "href" attribute to be present (attribute-misuse) at 

<ul class="pager pagination"><li class="pager__item page-item first disabled"><a>&lt;&lt;</a></li><li class="pager__item page-item disabled">
<a rel="prev">&lt;</a>
</li><li class="pager__item page-item active"><a href="/">1</a></li><li class="pager__item page-item"><a href="/?pagenum=2" rel="next">2</a></li><li class="pager__item page-item"><a href="/?pagenum=2" rel="next">&gt;</a></li><li class="pager__item page-item last"><a href="/?pagenum=2">&gt;&gt;</a></li></ul>

Details: https://html-validate.org/rules/attribute-misuse.html

The previous page link's Disabled property is set to true on page 1:
https://github.com/OrchardCMS/OrchardCore/blob/main/src/OrchardCore.Modules/OrchardCore.Navigation/PagerShapesTableProvider.cs#L234

Then the href attribute is removed:
https://github.com/OrchardCMS/OrchardCore/blob/main/src/OrchardCore.Modules/OrchardCore.Navigation/PagerShapesTableProvider.cs#L528

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions