Dnn.Platform icon indicating copy to clipboard operation
Dnn.Platform copied to clipboard

[Enhancement]: HTML5 Compliance: Replace deprecated name attributes with id attributes in Pane.cs

Open robsiera opened this issue 5 months ago • 1 comments

Is there an existing issue for this?

  • [x] I have searched the existing issues

Description of problem

  • What: DNN 10 still uses deprecated <a name="..."> elements in Pane.cs for module bookmarking
  • Why: HTML5 deprecated name attributes, modern browsers prefer id attributes for better accessibility and standards compliance
  • Earliest affected version: DNN 10 (all versions)
  • Reproduction/context: Any DNN 10 site with modules generates non-HTML5 compliant markup

Description of solution

  • Proposed change: Replace <a name="moduleId"> with id="moduleId" attribute on container control
  • Scope: Single file change in Library/UI/Skins/Pane.cs
  • Backwards compatibility: Full - same functionality, better standards compliance
  • Acceptance criteria:
    1. URL fragments (#moduleId) continue to work
    2. HTML5 validation passes
    3. No breaking changes to existing functionality
  • Release notes text: "Improved HTML5 compliance by replacing deprecated name attributes with id attributes in module containers"

Description of alternatives considered

  • Option A: Keep name attributes (rejected because HTML5 non-compliant)
  • Option B: Use data attributes (rejected because id is standard for this use case)

Anything else?

  • Code pointers: Library/UI/Skins/Pane.cs, module container generation
  • Screenshots/logs: HTML validation results before/after
  • W3C Reference: HTML5 Specification - Obsolete Features - The name attribute on <a> elements is listed as an obsolete but conforming feature and should be replaced with id attributes for better HTML5 compliance. Full current HTML5 Specification - Anchor Element

Do you plan to contribute code for this enhancement?

  • [x] Yes

Would you be interested in sponsoring this enhancement?

  • [ ] Yes

Code of Conduct

  • [x] I agree to follow this project's Code of Conduct

robsiera avatar Aug 25 '25 21:08 robsiera

The following notes was posted to the proposed solution, this ticket will be used to track the removal of this behavior in favor of other options.

@robsiera Thank you for bringing this to our attention.

In reviewing your submission and the HTML specification, the id value for an element should not start with a number. We further reviewed the markup of all rendered content and there are two different id values already rendered that are unique for each module content.

For HTML5 compliance, you can turn off the anchor links under "Site Settings" -> "Site Behavior" -> "More" -> "Inject Module Anchor" and utilize one of the existing id values in the format of dnn_ctr{MODULEID]_ContentPane or dnn_ctr{MODULEID]_ModuleContent if you want to have the direct linking behavior. I am going to update the reported issue to be able to track the marking of the setting as obsolete for future removal.

mitchelsellers avatar Aug 26 '25 19:08 mitchelsellers