Reported directly: clicking a label in the Labels popup no longer toggled
it onto the card (grow wider/apply on first click, shrink/remove on
second), with the browser console showing "card.board is not a function"
thrown from jQuery UI sortable's stop handler in
client/components/cards/labels.js (the label-reorder drag on
cardLabelsPopup).
jQuery UI's sortable widget runs its `stop` callback on mouseup whenever a
drag was registered, which ordinary mouse/trackpad clicks can trigger even
without an intentional drag - so this handler fires far more often than
"the user actually reordered labels." It resolved the card via
`Blaze.getData(this).board()`, where `this` is the sortable's root
`.edit-labels-pop-over` element; that does not reliably resolve back to a
real Card document with a callable `.board()`, so it threw. An uncaught
exception inside jQuery UI's own `_clear()` cleanup (which is what invokes
this `stop` callback) aborts the rest of that cleanup, consistent with the
toggle-on-click visuals getting stuck even though the click handler itself
runs independently.
The sibling `click .js-select-label` handler two lines below already had
the right fix for the same problem (added for linked-card labels): resolve
the board from the popup TEMPLATE's own data via `getCardLabelBoard(...)`,
never from `Blaze.getData` on a DOM node that may not carry the card
context the popup was actually opened with. Applied the same fix to the
`stop` handler.
tests/labelReorderStopHandler.test.cjs pins the fix and negatively checks
the old Blaze.getData(this) shape can't come back.
Verified against a real Meteor boot (`meteor run`) in-sandbox.
Thanks to xet7 !