Skip to content

Conversation

gitdallas
Copy link
Contributor

What: Closes #10974

@gitdallas gitdallas requested review from a team, dlabaj and rebeccaalpert and removed request for a team October 14, 2025 15:51
@patternfly-build
Copy link
Contributor

patternfly-build commented Oct 14, 2025

@gitdallas gitdallas force-pushed the fix/10974-truncate-remove-resizeObserver branch from 0104b5a to ec5e337 Compare October 14, 2025 15:57
@rebeccaalpert
Copy link
Member

rebeccaalpert commented Oct 14, 2025

I'd want to make sure that #11811 still works - noting this down so I don't forget when I come back to review this.

@gitdallas gitdallas force-pushed the fix/10974-truncate-remove-resizeObserver branch from ec5e337 to c047af3 Compare October 14, 2025 16:47
Signed-off-by: gitdallas <[email protected]>
@gitdallas gitdallas changed the title Fix/10974 truncate remove resize observer fix(Truncate): remove resize observer Oct 14, 2025
Copy link
Contributor

@thatblindgeye thatblindgeye left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One issue with this update is that the truncate always has a tabindex of 0 now, when it should really only have that when truncation is actually in effect. Otherwise potentially a lot of static text that isn't truncated will just add an equal amount of unneccessary tab stops to the page.

@gitdallas
Copy link
Contributor Author

@thatblindgeye - looks like i can set isTruncated to false originally and then it seems to work initially, however it won't update if something is resized.. maybe that doesn't matter as much as the performance? because i'm not sure if there is a better way to do this without adding the resizeObserver back

@thatblindgeye
Copy link
Contributor

looks like i can set isTruncated to false originally and then it seems to work initially, however it won't update if something is resized.. maybe that doesn't matter as much as the performance? because i'm not sure if there is a better way to do this without adding the resizeObserver back

I think both are important, though I don't know which (if either) is more important. That's probably a lengthier discussion.

@christianvogt for your use case, are you taking advantage of the resizability of the Truncate component, i.e. whether the content is actually truncated or not can change depending on the viewport width or the content can be of varying length? Or is it pretty reliable that wherever Truncate is being used things will always be Truncated or always not be Truncated (like in a Table column that is always fairly narrow)?

Mainly asking because if it's the latter - and assuming using the maxCharsDisplayed prop isn't viable - I wonder if adding a prop to dictate whether the resize observer is even used would be useful (or debouncing the resize observer).

@christianvogt
Copy link
Contributor

I believe when I created the original issue it was because the component was unmounting and remounting needlessly. Secondary after looking into the code I made the comment about performance and the potential to omit the resize handler. However I didn't consider the tab index case.

For our use case I would still like the text react to container size.

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.

Bug - [Truncate] - remove resize observer

5 participants