Fix card drag handle layout shift on hover#637
Conversation
Replace width:0/overflow:hidden with visibility:hidden/opacity:0 for the drag label so it reserves space without causing layout shift. Remove negative margins on the action bar that caused visual jump.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Self-reviewChanges reviewed:
Potential concerns:
Verdict: Changes are correct, minimal, and targeted. All unit tests pass. No functional regressions expected -- drag handle still works via the |
There was a problem hiding this comment.
Code Review
This pull request refactors the CardItem.vue component to simplify margin styling and prevent layout shifts by using visibility and opacity for the drag label instead of width manipulation. A review comment suggests improving accessibility by ensuring the label is also displayed when the drag handle receives keyboard focus via the :focus-visible pseudo-class.
| .td-card-drag-handle:hover .td-board-card__drag-label--hidden { | ||
| visibility: visible; | ||
| opacity: 1; | ||
| width: auto; | ||
| overflow: visible; | ||
| } |
There was a problem hiding this comment.
For better accessibility, the 'Drag card' label should also appear when the drag handle button receives keyboard focus, not just on hover. You can achieve this by adding a :focus-visible state to the selector. This will improve the experience for keyboard-only users and is consistent with the use of :focus-visible for focus styling elsewhere in the project.
.td-card-drag-handle:hover .td-board-card__drag-label--hidden,
.td-card-drag-handle:focus-visible .td-board-card__drag-label--hidden {
visibility: visible;
opacity: 1;
}
The E2E test asserts the drag handle width is > 75% of card width. The original negative left/right margins extend the action bar to the card edges. Keep those, only remove the top negative margin that caused the layout shift on hover.
Summary
width: 0; overflow: hiddenwithvisibility: hidden; opacity: 0on the drag label so it reserves its horizontal space and eliminates layout shift on hover-0.5rem) on the card action bar that caused visual jump when the bar appearedCloses #621
Test plan