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

SDK: Standardize React Component CSS Classes and HTML Structure #30955

Open
9 tasks
Tracked by #30943
rjvelazco opened this issue Dec 17, 2024 · 0 comments
Open
9 tasks
Tracked by #30943

SDK: Standardize React Component CSS Classes and HTML Structure #30955

rjvelazco opened this issue Dec 17, 2024 · 0 comments

Comments

@rjvelazco
Copy link
Contributor

rjvelazco commented Dec 17, 2024

Caution

THESE ARE BREAKING CHANGES AND SHOULD BE DOCUMENTED

Parent Issue

#30943

Overview

Currently, the Container component renders an extra wrapper <div> when inside the editor to initialize inline editing. This wrapper includes inline attributes such as data-dot-*. However, when styling the page, this extra <div> can disrupt user-defined CSS, leading to inconsistent layouts and unexpected behavior.

Task

  1. Update the Container React component to always include the extra wrapper div.
  2. Conditionally apply inline attributes (e.g., data-dot-*) to the wrapper div only when inside the editor (isInsideEditor).
  3. Ensure the wrapper div has a consistent class name: dot-container.
  4. Update all exposed CSS classes to include the dot- prefix (e.g., dot-container).
  5. Test and verify that the change resolves styling issues for users inside and outside the editor.
  6. Update relevant examples and documentation to reflect the changes.

Proposed Objective

Technical User Experience

Proposed Priority

Priority 3 - Average

Acceptance Criteria

Preview Give feedback

Assumptions & Initiation Needs

  • isInsideEditor reliably indicates whether the component is inside the dotCMS editor environment.
  • Existing inline editing functionality depends on the data-dot-* attributes.
  • The extra wrapper div does not cause rendering or structural issues when attributes are removed.

Quality Assurance Notes & Workarounds

  • Verify the component behavior in editing mode (inside the editor) and live mode (outside the editor).
  • Check that user-defined styles (CSS) apply consistently in both environments.
  • Check that all CSS classes exposed to users/clients have the dot- prefix.
  • Confirm that the attributes (data-dot-*) are not applied outside the editor, ensuring a clean DOM structure.
  • Ensure no unnecessary overhead is introduced by the wrapper div.

Sub-Tasks & Estimates

  1. Refactor the Container component to ensure attributes are conditionally applied.
  2. Add a consistent class name (dot-container) to the wrapper div.
  3. Write/update unit tests for the updated behavior:
    • Ensure attributes are present inside the editor.
    • Ensure attributes are absent outside the editor.
  4. Test the changes in both editor and non-editor environments.

Documentation

  • Update the React SDK documentation to clarify the wrapper div's role and behavior.
  • Add examples demonstrating the component's output both inside and outside the editor.
  • Include migration notes (if applicable) for developers using previous versions of the SDK.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: New
Development

No branches or pull requests

1 participant