adobe / adobe/spectrum-web-components

[Feat]: Truncated should reflect dynamic text updates

Open
#4,503 0 comments 0 reactions 0 assignees View on GitHub
Component:Truncated Feature
Dominant language
TypeScript
Stars
1.5k
Forks
262
Avg merge
3d 10h
Merged PRs (30d)
68

Description

### Code of conduct

- [X] I agree to follow this project's code of conduct.

### Impacted component(s)

Truncated

### Description of the requested feature

When the text in `sp-truncated` gets changed dynamically the component should reflect that changes and update the text in the tooltip.

### Mockups or screenshots

Current behavior, see: https://studio.webcomponents.dev/edit/bvy2ZIJMtqH0wE2L1kO4/src/index.ts?p=stories

### Implementation notes or ideas

I used MutationController from @lit-labs/observers/mutation-controller.js
to reflect textContent only changes from default slot with
```
new MutationController(this, {
config: {
characterData: true,
childList: true,
subtree: true,
},
callback: () => {
this.copyText()
},
})
```

Contributor guide

Open the contributing guide

Research direction

Start with the linked Studio Web Components reproduction for `sp-truncated` and inspect how its default-slot text is copied into the tooltip. Review the suggested `MutationController` approach and verify that changes to textContent, child nodes, and nested content update the tooltip; done means dynamic text is reflected reliably.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.