spectrum-web-components icon indicating copy to clipboard operation
spectrum-web-components copied to clipboard

docs(sp-truncated): updated sp-truncated pattern

Open Rajdeepc opened this issue 1 month ago • 11 comments

Description

Comprehensive documentation rewrite for sp-truncated with full API reference, accessibility guidelines, usage patterns, and practical examples across multiple component contexts.

Added sp-truncated to bundle/elements.ts to ensure proper component registration and CSS rendering in documentation demo blocks.

Motivation and context

Related issue(s)

  • fixes SWC-431

Screenshots (if appropriate)


Author's checklist

  • [ ] I have read the CONTRIBUTING and PULL_REQUESTS documents.
  • [ ] I have reviewed at the Accessibility Practices for this feature, see: Aria Practices
  • [ ] I have added automated tests to cover my changes.
  • [ ] I have included a well-written changeset if my change needs to be published.
  • [ ] I have included updated documentation if my change required it.

Reviewer's checklist

  • [ ] Includes a Github Issue with appropriate flag or Jira ticket number without a link
  • [ ] Includes thoughtfully written changeset if changes suggested include patch, minor, or major features
  • [ ] Automated tests cover all use cases and follow best practices for writing
  • [ ] Validated on all supported browsers
  • [ ] All VRTs are approved before the author can update Golden Hash

Manual review test cases

  • [ ] Descriptive Test Statement

    1. Go here
    2. Do this action
    3. Expect this result
  • [ ] Descriptive Test Statement

    1. Go here
    2. Do this action
    3. Expect this result

Device review

  • [ ] Did it pass in Desktop?
  • [ ] Did it pass in (emulated) Mobile?
  • [ ] Did it pass in (emulated) iPad?

Rajdeepc avatar Oct 28 '25 13:10 Rajdeepc

⚠️ No Changeset found

Latest commit: b93fcf4972173cb82c62ef41cb815a91dc46e343

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

changeset-bot[bot] avatar Oct 28 '25 13:10 changeset-bot[bot]

📚 Branch Preview

🔍 Visual Regression Test Results

When a visual regression test fails (or has previously failed while working on this branch), its results can be found in the following URLs:

Deployed to Azure Blob Storage: pr-5839

If the changes are expected, update the current_golden_images_cache hash in the circleci config to accept the new images. Instructions are included in that file. If the changes are unexpected, you can investigate the cause of the differences and update the code accordingly.

github-actions[bot] avatar Oct 28 '25 13:10 github-actions[bot]

Tachometer results

Currently, no packages are changed by this PR...

github-actions[bot] avatar Oct 28 '25 13:10 github-actions[bot]

Pull Request Test Coverage Report for Build 18939955006

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 97.964%

Totals Coverage Status
Change from base Build 18885025935: 0.0%
Covered Lines: 34259
Relevant Lines: 34788

💛 - Coveralls

coveralls avatar Oct 28 '25 13:10 coveralls

Known issue: sp-tooltip is getting cut off due to max-width constraint for long words. Will be tacked in SWC-1331

Rajdeepc avatar Oct 30 '25 12:10 Rajdeepc

Looks good. I only have a couple of questions/suggestions. Also I noticed that the API tab for truncated is all empty and I wonder if that's an easy fix or should we address that separately?

Yes in our component generation template we are explicitly checking for public properties to show in the API tab. For me this is too restrictive. When there is no modifier, it infers as privacy-> undefined. We can change the logic to place everything which is not private. Let's take this in a separate PR.

return member?.privacy !== 'private';

Rajdeepc avatar Nov 10 '25 07:11 Rajdeepc

Looks good. I only have a couple of questions/suggestions. Also I noticed that the API tab for truncated is all empty and I wonder if that's an easy fix or should we address that separately?

Yes in our component generation template we are explicitly checking for public properties to show in the API tab. For me this is too restrictive. When there is no modifier, it infers as privacy-> undefined. We can change the logic to place everything which is not private. Let's take this in a separate PR.

return member?.privacy !== 'private';

I believe we should require every property has a modifier instead of loosing the API table generation. we should be intentional about our properties

caseyisonit avatar Nov 10 '25 18:11 caseyisonit

I have major accessibility concerns with this component that we need to discuss as a team.

For this specific docs PR:

  • I am seeing correct copy to clipboard.
  • I am seeing INCORRECT rendering of tooltip container on several examples when hovering. Screenshot 2025-11-10 at 11 05 51 AM Screenshot 2025-11-10 at 11 06 14 AM

caseyisonit avatar Nov 10 '25 18:11 caseyisonit

Looks good. I only have a couple of questions/suggestions. Also I noticed that the API tab for truncated is all empty and I wonder if that's an easy fix or should we address that separately?

Yes in our component generation template we are explicitly checking for public properties to show in the API tab. For me this is too restrictive. When there is no modifier, it infers as privacy-> undefined. We can change the logic to place everything which is not private. Let's take this in a separate PR.

return member?.privacy !== 'private';

Yup! You got this right. I did update it in my last PR so it should be fine now (since this is up to date with main). Everything which is not private should be in the API table for now.

TarunAdobe avatar Nov 11 '25 06:11 TarunAdobe

📚 Branch Preview Links

🔍 First Generation Visual Regression Test Results

When a visual regression test fails (or has previously failed while working on this branch), its results can be found in the following URLs:

Deployed to Azure Blob Storage: pr-5839

If the changes are expected, update the current_golden_images_cache hash in the circleci config to accept the new images. Instructions are included in that file. If the changes are unexpected, you can investigate the cause of the differences and update the code accordingly.

github-actions[bot] avatar Nov 20 '25 08:11 github-actions[bot]

I have major accessibility concerns with this component that we need to discuss as a team.

For this specific docs PR:

  • I am seeing correct copy to clipboard.
  • I am seeing INCORRECT rendering of tooltip container on several examples when hovering.

Screenshot 2025-11-10 at 11 05 51 AM Screenshot 2025-11-10 at 11 06 14 AM

Kept this PR open due to the tooltip issue as noted here. It should be fixed now with SWC-1331 being closed

Rajdeepc avatar Nov 20 '25 08:11 Rajdeepc