Skip to content
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

[Console] Fix actions menu scrolling issue #200018

Merged
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,19 @@ export class MonacoEditorActionsProvider {
visibility: 'hidden',
});
} else {
// if a request is selected, the actions buttons are placed at lineNumberOffset - scrollOffset
const offset = this.editor.getTopForLineNumber(lineNumber) - this.editor.getScrollTop();
const lineTop = this.editor.getTopForLineNumber(lineNumber);
const scrollTop = this.editor.getScrollTop();
const offset = lineTop - scrollTop;

// Ensure offset is never less than or equal to zero, moving it down
// by 1 px if needed.
const adjustedOffset = offset <= 0 ? 1 : offset;

this.setEditorActionsCss({
visibility: 'visible',
// Move position down by 1 px so that the action buttons panel doesn't cover the top border of the selected block
top: offset + 1,
// Move position down by 1 px so that the action buttons panel doesn't
// cover the top border of the selected block.
top: adjustedOffset + 1,
});
}
}
Expand Down