mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-20 08:04:03 +00:00
fix(vcs): run the merge editor's buttons on a mouse click on macOS (#3160)
WebKit doesn't focus a clicked button, so focus moved to the editor area outside the merge editor and cleared the focused merge editor; Apply, Cancel, Accept Yours/Theirs and the toolbar actions then did nothing on a mouse click. The merge editor root is now focusable (tabindex -1) so a click inside it keeps focus there.
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background: var(--bg-app);
|
||||
outline: none;
|
||||
}
|
||||
.toolbar {
|
||||
flex: none;
|
||||
@@ -84,6 +85,7 @@
|
||||
}
|
||||
.message {
|
||||
flex: 1;
|
||||
outline: none;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
|
||||
@@ -541,6 +541,10 @@ export function MergeEditor({ input }: { input: EditorInput }) {
|
||||
}, [actionHost]);
|
||||
|
||||
const focusProps = {
|
||||
// WebKit doesn't focus a clicked button: focus then moves to the nearest focusable
|
||||
// ancestor, which must be this editor for the footer and toolbar buttons to keep it the
|
||||
// focused merge editor their actions run in.
|
||||
tabIndex: -1,
|
||||
onFocusCapture: (e: React.FocusEvent<HTMLDivElement>) => {
|
||||
const target = e.target as Node;
|
||||
if (oursRef.current?.contains(target)) paneRef.current = "left";
|
||||
|
||||
Reference in New Issue
Block a user