Commit ad48aa0
* feat(ux): show the add-comment button as disabled until text is selected (#96)
Commenting requires a selection; clicking the toolbar button with nothing
selected only popped a hint. Now the button is greyed (opacity + not-allowed
cursor, aria-disabled) whenever the selection is empty, and becomes active as
soon as text is selected — driven off aceEditEvent's rep.
Deliberately visual-only: the button stays clickable and still falls back to
the existing 'select text first' hint, so the primary action can never get
stuck disabled if a selection event is missed.
Pure plugin change — works on the latest release (2.7.3) and develop without a
core update. Adds a Playwright test that checks the state toggles
disabled→enabled→disabled as the selection changes.
Closes #96
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(#96): block add-comment activation while disabled + cache hot path
- Don't open the new-comment form when there is no selection: an
aria-disabled control must not be activatable by mouse or keyboard.
- Cache the button collection and skip DOM work in updateAddCommentButtonState
when the selection state is unchanged (aceEditEvent is a hot hook).
- Test: assert the disabled button does not open the form, and that it
does once text is selected.
* fix(#96): guard add-comment on the live selection, not a stale flag
The cached _addCommentDisabled flag lags a just-made selection (it's
updated by the async aceEditEvent), so guarding the click on it blocked
legitimate clicks made immediately after selecting — breaking the shared
addCommentToLine test helper and every comment-box test that uses it.
Check the live ace selection at click time instead, defaulting to allow
on any read failure (displayNewCommentForm still guards the empty case).
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 4f3c29b commit ad48aa0
3 files changed
Lines changed: 140 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
396 | 396 | | |
397 | 397 | | |
398 | 398 | | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
399 | 407 | | |
400 | 408 | | |
401 | 409 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
165 | 171 | | |
166 | 172 | | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
167 | 180 | | |
168 | 181 | | |
169 | 182 | | |
| |||
1043 | 1056 | | |
1044 | 1057 | | |
1045 | 1058 | | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
1046 | 1080 | | |
1047 | 1081 | | |
1048 | 1082 | | |
| |||
1236 | 1270 | | |
1237 | 1271 | | |
1238 | 1272 | | |
| 1273 | + | |
| 1274 | + | |
| 1275 | + | |
| 1276 | + | |
| 1277 | + | |
| 1278 | + | |
| 1279 | + | |
| 1280 | + | |
| 1281 | + | |
| 1282 | + | |
| 1283 | + | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
1239 | 1293 | | |
1240 | 1294 | | |
1241 | 1295 | | |
| |||
1648 | 1702 | | |
1649 | 1703 | | |
1650 | 1704 | | |
1651 | | - | |
1652 | | - | |
1653 | | - | |
| 1705 | + | |
| 1706 | + | |
| 1707 | + | |
1654 | 1708 | | |
| 1709 | + | |
1655 | 1710 | | |
1656 | 1711 | | |
1657 | 1712 | | |
| |||
Lines changed: 74 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 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
0 commit comments