Commit 8c2b974
authored
fix(Alert): honour explicit role={undefined} to suppress role attribute (#490)
* fix(Alert): honour explicit role={undefined} to suppress role attribute
When role={undefined} is passed, the component was still rendering
role="alert" because the destructuring default applies to undefined
values unconditionally.
Fix: remove the default from the destructuring and use "role" in props
to distinguish "caller did not pass role" (default to "alert") from
"caller explicitly passed undefined" (no role attribute rendered).
Fixes #478
* refactor(Alert): remove redundant role spread and refShouldSetRole ref
The first spread was always overridden by the second one: when
role !== undefined both spreads set the same value, and when role
is undefined neither fires. Drop the dead ref and simplify to a
single conditional spread.
Addresses review comment from revolunet.1 parent 3590215 commit 8c2b974
1 file changed
Lines changed: 6 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
| 77 | + | |
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
81 | 85 | | |
82 | 86 | | |
83 | 87 | | |
| |||
90 | 94 | | |
91 | 95 | | |
92 | 96 | | |
93 | | - | |
94 | 97 | | |
95 | 98 | | |
96 | 99 | | |
| |||
100 | 103 | | |
101 | 104 | | |
102 | 105 | | |
103 | | - | |
104 | 106 | | |
105 | 107 | | |
106 | 108 | | |
| |||
147 | 149 | | |
148 | 150 | | |
149 | 151 | | |
150 | | - | |
151 | | - | |
| 152 | + | |
152 | 153 | | |
153 | 154 | | |
154 | 155 | | |
| |||
0 commit comments