Skip to content

Fix incorrect CAPTCHA drag image on scaled Linux display (uplift to 1.38.x) #13094

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

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ export function GrantCaptchaChallenge (props: Props) {
x: (rect.width / 2) - (event.clientX - rect.left),
y: (rect.height / 2) - (event.clientY - rect.top)
})

// Work around Linux-specific upstream bug by explicitly setting the drag
// image offset when initiating the drag
// See https://bugs.chromium.org/p/chromium/issues/detail?id=1297990
if (window.navigator.userAgent.includes('Linux') && devicePixelRatio > 1) {
event.dataTransfer.setDragImage(
target,
event.clientX - rect.left,
event.clientY - rect.top)
}
}

function onDragOver (event: React.DragEvent) {
Expand Down