Commit d473ab6
* fix: filtertag overflow via resizeobserver (#949)
Replaces the ref-during-render measurement (which only computed
isOverflowed once mid-render with a null ref, then never reacted
to layout changes) with a ResizeObserver inside a dedicated
useTooltipTitle hook that returns the chip ref and the tooltip
title together.
The tooltip now stays accurate across container resizes, font
loads, and label changes. Hook lives at
src/components/Filter/components/FilterTag/hooks/UseTooltipTitle/
following the existing per-folder hook convention.
Companion to #941 (PR #950) — once that lands the
react-hooks/refs suppression added there is no longer needed and
will be dropped on rebase.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* chore: drop unused superseded prop and SupersededTag styled (#949)
Audit while landing #949 revealed superseded was always passed as
false from every call site (filters.tsx, FilterTag/utils.ts,
stories args, filterTags.stories.tsx) and the SupersededTag
styled component was therefore never rendered.
Strips the prop from CategoryTag, FilterTag, FilterTags, and the
two stories files. Deletes filterTag.styles.ts (only contained
SupersededTag).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* test: cover useTooltipTitle overflow detection (#949)
Adds Jest/RTL coverage for the new FilterTag tooltip behaviour:
- Suppresses the tooltip when offsetWidth === scrollWidth
- Shows the label as the tooltip title when scrollWidth > offsetWidth
- Re-evaluates on subsequent ResizeObserver fires (truncated then
fits again)
ResizeObserver is mocked to capture callbacks so the tests can
trigger re-measurement deterministically; .MuiChip-label
dimensions are overridden via Object.defineProperty so the
overflow check returns a known result in jsdom.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Fran McDade <18710366+frano-m@users.noreply.github.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 7ef5366 commit d473ab6
11 files changed
Lines changed: 148 additions & 45 deletions
File tree
- src
- common
- components/Filter/components
- FilterTags
- FilterTag
- hooks/UseTooltipTitle
- stories
- Filters
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
44 | 43 | | |
45 | 44 | | |
46 | 45 | | |
| |||
Lines changed: 0 additions & 7 deletions
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
| 3 | + | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | 9 | | |
11 | 10 | | |
12 | 11 | | |
| |||
26 | 25 | | |
27 | 26 | | |
28 | 27 | | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
42 | 31 | | |
43 | 32 | | |
44 | 33 | | |
45 | 34 | | |
46 | 35 | | |
47 | | - | |
| 36 | + | |
48 | 37 | | |
49 | | - | |
| 38 | + | |
50 | 39 | | |
51 | 40 | | |
52 | 41 | | |
53 | 42 | | |
54 | 43 | | |
55 | 44 | | |
56 | | - | |
| 45 | + | |
57 | 46 | | |
58 | 47 | | |
59 | 48 | | |
| |||
Lines changed: 28 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
Lines changed: 0 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | 9 | | |
11 | 10 | | |
12 | 11 | | |
13 | 12 | | |
14 | 13 | | |
15 | | - | |
16 | 14 | | |
17 | 15 | | |
18 | 16 | | |
19 | 17 | | |
20 | 18 | | |
21 | | - | |
22 | 19 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
32 | 31 | | |
33 | 32 | | |
34 | 33 | | |
| |||
Lines changed: 0 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
35 | 34 | | |
36 | 35 | | |
37 | 36 | | |
38 | 37 | | |
39 | | - | |
40 | 38 | | |
41 | 39 | | |
42 | 40 | | |
43 | 41 | | |
44 | | - | |
45 | 42 | | |
46 | 43 | | |
47 | 44 | | |
48 | 45 | | |
49 | | - | |
50 | 46 | | |
51 | 47 | | |
52 | 48 | | |
53 | 49 | | |
54 | | - | |
55 | 50 | | |
56 | 51 | | |
57 | 52 | | |
58 | 53 | | |
59 | | - | |
60 | 54 | | |
61 | 55 | | |
62 | 56 | | |
| |||
Lines changed: 2 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
| 13 | + | |
| 14 | + | |
20 | 15 | | |
21 | 16 | | |
22 | 17 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
56 | 55 | | |
57 | 56 | | |
58 | 57 | | |
| |||
0 commit comments