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

DOCS-189: Fix Code Snippet bugs when used inside Table component #2373

Conversation

danielamorse
Copy link
Collaborator

@danielamorse danielamorse commented Nov 3, 2021

Jira

https://pegadigitalit.atlassian.net/browse/DOCS-189

Summary

Fixes Code Snippet bugs when used inside Table component.

Details

Table component strips whitespace around tags and text and in the process rewrites the DOM for every element inside. This breaks indentation on Code Snippets and loses any event handlers added prior to Table initializing.

Long term, Table will be rewritten to not do any of this. Short term, this PR tells Code Snippet to not automatically initialize when inside a Table. Then, tells Table to call the Code Snippet initialization after the Table is rendered.

I had to add Code Snippet as a dependency of Table, which means Code Snippet is loaded whenever a Table is present (not just when a Code Snippet is present). I did a few lighthouse checks and didn't notice any difference before and after.

How to test

  • Review code changes
  • Review Code Snippet and Table demos for regressions
  • Review test page (http://localhost:3000/pattern-lab/patterns/999-tests-code-snippet-15-code-snippet-table/999-tests-code-snippet-15-code-snippet-table.html) which shows the use case we're solving for. Verify the Code Snippets are properly indented and the Copy button works.

@github-actions github-actions bot added the version: patch Use only on PRs to the release branch. Increments the patch version when merged. label Nov 3, 2021
@danielamorse danielamorse removed the version: patch Use only on PRs to the release branch. Increments the patch version when merged. label Nov 3, 2021
@danielamorse danielamorse force-pushed the hotfix/DOCS-189-code-snippet-in-table branch from a186994 to da29182 Compare November 3, 2021 18:50
@danielamorse danielamorse force-pushed the hotfix/DOCS-189-code-snippet-in-table branch from da29182 to 4f4f6fd Compare November 3, 2021 18:50
@danielamorse danielamorse merged commit 19945d0 into hotfix/v4.6.2-code-snippet-and-teaser Nov 3, 2021
@danielamorse danielamorse deleted the hotfix/DOCS-189-code-snippet-in-table branch November 3, 2021 18:51
@danielamorse danielamorse mentioned this pull request Nov 3, 2021
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.

2 participants