Skip to content

Conversation

@ziadalazwak
Copy link

@ziadalazwak ziadalazwak commented Sep 24, 2025

When rendering the Pager shape, the “Previous” link is shown as disabled on the first page.
However, it was still outputting an element with a rel attribute but no href, which causes an HTML validation error.

Example before fix:

<li class="pager__item page-item disabled">
  <a rel="prev"><</a>
</li>

This PR updates the ActionLink shape to remove the entirely when disabled, while keeping the <li class="disabled"> placeholder for consistent layout.

Example after fix:

<li class="pager__item page-item disabled"></li>

Fixes #17907

@github-actions
Copy link
Contributor

Thank you for submitting your first pull request, awesome! 🚀 If you haven't already, please take a moment to review our contribution guide. This guide provides helpful information to ensure your contribution aligns with our standards. A core team member will review your pull request.

If you like Orchard Core, please star our repo and join our community channels.

@ziadalazwak
Copy link
Author

@dotnet-policy-service agree

Copy link
Member

@hishamco hishamco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't add many whitespaces next time

@ziadalazwak
Copy link
Author

Applied your suggestion, thanks @hishamco

}
else
{
shape.Attributes.Remove("href");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this removed?

@ziadalazwak
Copy link
Author

I removed shape.Attributes.Remove("href") because when a pager item is disabled,
we now skip rendering the <a> tag entirely. Since there’s no <a> in that case,
there’s no need to remove href anymore.

@ziadalazwak
Copy link
Author

Hi @hishamco, just wanted to follow up on your last comment. Since the tag is no longer rendered for disabled items, I removed the shape.Attributes.Remove("href") call as it’s not needed anymore. Could you please confirm if this resolves your concern?

@hishamco
Copy link
Member

Could you please take a GIF screenshot to see what it looks like now

@ziadalazwak
Copy link
Author

ziadalazwak commented Sep 26, 2025

As shown in the GIF below, the pager now behaves correctly:

Animation

  • On the first page, the “Previous” and “First” links are disabled without rendering invalid <a> tags.

@hishamco
Copy link
Member

@Piedone, do you have anything to add here, or shall we merge

@Piedone
Copy link
Member

Piedone commented Sep 26, 2025

I didn't check the code (on mobile) but from the above comments the results look good.

@hishamco
Copy link
Member

@wAsnk, do you want to check this PR?

@ziadalazwak
Copy link
Author

Hi @hishamco, @Piedone — just wanted to follow up to see if there’s anything else needed from my side to move this PR forward. Thanks again for the review and guidance!

@Piedone
Copy link
Member

Piedone commented Oct 1, 2025

Nothing else from my side, up to Hisham.

@wAsnk
Copy link
Contributor

wAsnk commented Oct 1, 2025

@wAsnk, do you want to check this PR?

Looks good to me.

@Piedone
Copy link
Member

Piedone commented Oct 7, 2025

@hishamco can't this be merged?

@ziadalazwak
Copy link
Author

Hi @hishamco,

It’s been a while since the last update, and I noticed the PR has already passed all checks and received approvals. Could you please let me know if there’s any reason it hasn’t been merged yet?

I’ve been waiting for some feedback or final confirmation, and it’s a bit discouraging not to hear back after addressing all comments and providing the requested changes. I’d really appreciate an update on this.

Thanks,
Ziad

Copy link
Member

@gvkries gvkries left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing the entire <a> tag also removes its inner content, including text and icons, because the associated value is no longer rendered. This can unintentionally break existing themes and layouts.

For example, in the admin interface, the pager changes from:
Image

to:
Image

To preserve the structure and visual integrity, only the rel attribute should be removed not the entire anchor tag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pager shape HTML validation issue

5 participants