New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draggable: only set drag handle props on the drag handle itself #50025
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent job tracking down the cause of this and coming up with a good fix! I want to demo this first to see what it's like in practice.
Not super in love with defining functions inline in (functional) components - a lot of the times it's just components within components, especially more so since the argument is called "props" 😅. Maybe we can just hoist this out to a component to this file?
@@ -93,7 +93,7 @@ export const QueryOperationRow: React.FC<QueryOperationRowProps> = ({ | |||
const actionsElement = actions && ReactUtils.renderOrCallToRender(actions, renderPropArgs); | |||
const headerElementRendered = headerElement && ReactUtils.renderOrCallToRender(headerElement, renderPropArgs); | |||
|
|||
const rowHeader = ( | |||
const getRowHeader = (dragHandleProps?: DraggableProvidedDragHandleProps) => ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this... a... component? 😇
Hmmm..... In practice, I think the drag handle is quite small and awfully close to the no-confirm Delete button We could give the handle a bunch of padding and offset that with negative margins (to make the drag handle flush with the outer bounds of the row), and push it a bit away from the action buttons? (red bg mine, to show the target size) quick inspector CSS: padding: 7px;
margin: -9px;
margin-left: calc(16px - 7px); |
Drone build failed: https://drone.grafana.net/grafana/grafana-enterprise/20657 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works like a charm, LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏🏾
(cherry picked from commit 0de9808)
What this PR does / why we need it:
react-select
onControlMouseDown
function inreact-select
ifevent.defaultPrevented = true
react-beatiful-dnd
setsevent.preventDefault()
on it's drag handlersdragHandleProps
onto elements that weren't the drag handles themselves, but instead the whole row.Which issue(s) this PR fixes:
Fixes #49867
Special notes for your reviewer: