Skip to content

ref(components): extracted a DragReorderButton component#110982

Merged
JoshuaKGoldberg merged 1 commit intomasterfrom
drag-reorder-button
Mar 27, 2026
Merged

ref(components): extracted a DragReorderButton component#110982
JoshuaKGoldberg merged 1 commit intomasterfrom
drag-reorder-button

Conversation

@JoshuaKGoldberg
Copy link
Copy Markdown
Member

@JoshuaKGoldberg JoshuaKGoldberg commented Mar 18, 2026

As noted in #110842 (comment), we have a lot of very similar drag-to-reorder buttons. This extracts a shared DragReorderButton component for all of them.

One notable change: style={{cursor: 'grab'}} was only added in one existing component, under rules/uptime/assertions. Now it's in the shared one. I'm checking with design today and we might end up changing it - but I don't think the single cursor style should block review. Confirmed we prefer the grabby one.

Fixes EXP-856

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Mar 18, 2026
@@ -14,7 +15,7 @@ export interface QueryFieldProps {
fieldOptions: React.ComponentProps<typeof TableQueryField>['fieldOptions'];
onChange: (newValue: QueryFieldValue) => void;
value: QueryFieldValue;
attributes?: UseDraggableArguments['attributes'];
attributes?: DraggableAttributes;
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While we're here 😄

Copy link
Copy Markdown
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

size="zero"
priority="transparent"
/>
<StyledDragReorderButton />
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inline cursor style overrides ghost's grabbing cursor

Medium Severity

The Ghost styled component uses button { cursor: grabbing; } to show a "grabbing" cursor on all buttons during an active drag. Previously, the old DragAndReorderButton didn't set any inline cursor style, so the Ghost's CSS worked. Now, DragReorderButton always applies style={{cursor: 'grab'}} as an inline style, which has higher specificity than any CSS class rule and cannot be overridden by the Ghost's button { cursor: grabbing; } selector. This causes the drag handle in the ghost overlay to incorrectly show a grab cursor instead of grabbing while dragging.

Additional Locations (1)
Fix in Cursor Fix in Web

Copy link
Copy Markdown
Member Author

@JoshuaKGoldberg JoshuaKGoldberg Mar 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Question] 🤔 I'm not sure which way is better... the custom ghost-y one before, or aligning to the new way?

Copy link
Copy Markdown
Member Author

@JoshuaKGoldberg JoshuaKGoldberg Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this comment is wrong. This is already visually buggy. Both in dev and on prod, the standard cursor is shown and the ghost visualization is offset too far to the right:

Screenshot of dragging a visualization in the Widget builder, showing the default cursor and a ghost visualization row 50% of its width to the right

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I'm talking with product about filing an issue)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@linear-code
Copy link
Copy Markdown

linear-code bot commented Mar 27, 2026

@JoshuaKGoldberg JoshuaKGoldberg merged commit b8b2220 into master Mar 27, 2026
69 of 70 checks passed
@JoshuaKGoldberg JoshuaKGoldberg deleted the drag-reorder-button branch March 27, 2026 17:18
@github-actions github-actions bot locked and limited conversation to collaborators Apr 12, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants