Skip to content

Feature: Standardize HTML class attribute naming (className → class) #989

@hxrshxz

Description

@hxrshxz

Increasing Access

Making the code style consistent helps keep the project easier to read and understand, especially for new contributors. Right now, some parts of the code use className and others use class. Sticking to class everywhere follows Preact’s best practices and standard HTML, which makes things simpler and less confusing for everyone.

Most appropriate sub-area of p5.js?

Code Quality / Refactoring

Feature request details

Description

This is a code quality improvement to standardize the use of HTML class attributes throughout the codebase.

Current Issue

The codebase inconsistently uses both className and class attributes. Some files use class, others use className, and some mix both within the same file.

Proposed Solution

Replace all instances of className with class throughout the codebase to maintain consistency with Preact best practices.

Files That Need Updates (74 total instances across 23 files)

High Priority - TSX/JSX Components (54 instances):

  • src/components/Icon/index.tsx - 20 instances
  • src/components/SearchResults/index.tsx - 10 instances
  • src/components/Dropdown/index.tsx - 9 instances
  • src/components/CodeEmbed/index.jsx - 7 instances
  • src/components/AccessibilitySettings/index.tsx - 6 instances
  • src/components/ReferenceSidebar/index.tsx - 6 instances
  • src/components/ReferenceDirectoryWithFilter/index.tsx - 5 instances
  • src/components/Sidebar/JumpToSection/index.tsx - 5 instances
  • src/components/CircleButton/index.tsx - 2 instances (lines 7, 18)
  • src/components/CodeFrame/index.tsx - 2 instances (lines 34, 38)
  • src/components/Nav/MainNavLinks.tsx - 2 instances (lines 87, 99) MIXED with class
  • src/components/CopyCodeButton/index.tsx - 1 instance (line 39)
  • src/components/Sidebar/index.tsx - 1 instance (line 49)

Medium Priority - Astro Components (4 instances):

  • src/components/LinkButton/index.astro - 1 instance (line 11)
  • src/components/PaginationNav/index.astro - 1 instance (line 12)
  • src/components/PageHeader/HomePage.astro - 1 instance (line 23)
  • src/components/PageHeader/ItemPage.astro - 1 instance (line 23)

Lower Priority - Layout Files (13 instances):

  • src/layouts/ReferenceItemLayout.astro - 4 instances (lines 33, 42, 44, 52) MIXED with class
  • src/layouts/TextDetailLayout.astro - 3 instances (lines 23, 32, 34)
  • src/layouts/TutorialLayout.astro - 3 instances (lines 23, 32, 34)
  • src/layouts/ContributorDocLayout.astro - 1 instance (line 21)
  • src/layouts/ExampleLayout.astro - 1 instance (line 21)
  • src/layouts/PeopleLayout.astro - 1 instance (line 21)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions