Skip to content

Commit 0a589c3

Browse files
committed
Set overflow scroll to auto for mirror div
Align overflow scroll for the mirror div with the textarea. Otherwise if the textarea did not have scrollbars, text in the mirror div would wrap sooner than text in the textarea. On macOS where overlay scrollbars are used this has no effect, since the layout of the text is unaffected by whether scrollbars are "present".
1 parent 276aa0b commit 0a589c3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/sidebar/util/textarea-caret-position.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export function getCaretCoordinates(textarea: HTMLTextAreaElement): {
7272
// Adjust scroll position to match the textarea. For this to work, the
7373
// scrollable height of the mirror must be at least equal to the scrollable
7474
// height of the text area.
75-
mirrorDiv.style.overflow = 'scroll';
75+
mirrorDiv.style.overflowY = 'auto';
7676
mirrorDiv.scrollTop = textarea.scrollTop;
7777

7878
// Capture caret position relative to top-left corner of textarea.

0 commit comments

Comments
 (0)