@instructure/ui-source-code-editor 11.7.2-snapshot-27 → 11.7.2-snapshot-28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,9 +3,12 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ## [11.7.2-snapshot-27](https://github.com/instructure/instructure-ui/compare/v11.7.1...v11.7.2-snapshot-27) (2026-04-02)
6
+ ## [11.7.2-snapshot-28](https://github.com/instructure/instructure-ui/compare/v11.7.1...v11.7.2-snapshot-28) (2026-04-07)
7
7
 
8
- **Note:** Version bump only for package @instructure/ui-source-code-editor
8
+
9
+ ### Bug Fixes
10
+
11
+ * **ui-source-code-editor:** preserve scroll position in controlled mode ([49dd754](https://github.com/instructure/instructure-ui/commit/49dd754ffd5518219cec5e55d65e9ca86dfc5868))
9
12
 
10
13
 
11
14
 
@@ -477,6 +477,7 @@ let SourceCodeEditor = (_dec = withDeterministicId(), _dec2 = withStyle(generate
477
477
  } else if (lengthDiff === -1) {
478
478
  userEvent = 'delete.backward';
479
479
  }
480
+ const scrollTop = this._editorView.scrollDOM.scrollTop;
480
481
  this.dispatchViewChanges({
481
482
  changes: {
482
483
  from: 0,
@@ -486,6 +487,13 @@ let SourceCodeEditor = (_dec = withDeterministicId(), _dec2 = withStyle(generate
486
487
  selection: this._newSelectionAfterValueChange,
487
488
  userEvent: userEvent
488
489
  });
490
+
491
+ // Restore scroll position after CodeMirror updates the DOM
492
+ this.addAnimationFrame(() => {
493
+ if (this._editorView) {
494
+ this._editorView.scrollDOM.scrollTop = scrollTop;
495
+ }
496
+ });
489
497
  this._newSelectionAfterValueChange = void 0;
490
498
  }
491
499
  if (this.props.indentOnLoad) {
@@ -484,6 +484,7 @@ let SourceCodeEditor = exports.SourceCodeEditor = (_dec = (0, _withDeterministic
484
484
  } else if (lengthDiff === -1) {
485
485
  userEvent = 'delete.backward';
486
486
  }
487
+ const scrollTop = this._editorView.scrollDOM.scrollTop;
487
488
  this.dispatchViewChanges({
488
489
  changes: {
489
490
  from: 0,
@@ -493,6 +494,13 @@ let SourceCodeEditor = exports.SourceCodeEditor = (_dec = (0, _withDeterministic
493
494
  selection: this._newSelectionAfterValueChange,
494
495
  userEvent: userEvent
495
496
  });
497
+
498
+ // Restore scroll position after CodeMirror updates the DOM
499
+ this.addAnimationFrame(() => {
500
+ if (this._editorView) {
501
+ this._editorView.scrollDOM.scrollTop = scrollTop;
502
+ }
503
+ });
496
504
  this._newSelectionAfterValueChange = void 0;
497
505
  }
498
506
  if (this.props.indentOnLoad) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-source-code-editor",
3
- "version": "11.7.2-snapshot-27",
3
+ "version": "11.7.2-snapshot-28",
4
4
  "description": "A UI component library made by Instructure Inc.",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "module": "./es/index.js",
@@ -29,24 +29,24 @@
29
29
  "@codemirror/state": "^6.4.1",
30
30
  "@codemirror/view": "^6.34.1",
31
31
  "@lezer/highlight": "1.2.1",
32
- "@instructure/emotion": "11.7.2-snapshot-27",
33
- "@instructure/shared-types": "11.7.2-snapshot-27",
34
- "@instructure/ui-buttons": "11.7.2-snapshot-27",
35
- "@instructure/ui-a11y-content": "11.7.2-snapshot-27",
36
- "@instructure/ui-dom-utils": "11.7.2-snapshot-27",
37
- "@instructure/ui-i18n": "11.7.2-snapshot-27",
38
- "@instructure/ui-react-utils": "11.7.2-snapshot-27",
39
- "@instructure/ui-text-input": "11.7.2-snapshot-27",
40
- "@instructure/ui-icons": "11.7.2-snapshot-27",
41
- "@instructure/ui-themes": "11.7.2-snapshot-27",
42
- "@instructure/ui-utils": "11.7.2-snapshot-27"
32
+ "@instructure/emotion": "11.7.2-snapshot-28",
33
+ "@instructure/ui-a11y-content": "11.7.2-snapshot-28",
34
+ "@instructure/shared-types": "11.7.2-snapshot-28",
35
+ "@instructure/ui-buttons": "11.7.2-snapshot-28",
36
+ "@instructure/ui-dom-utils": "11.7.2-snapshot-28",
37
+ "@instructure/ui-i18n": "11.7.2-snapshot-28",
38
+ "@instructure/ui-icons": "11.7.2-snapshot-28",
39
+ "@instructure/ui-react-utils": "11.7.2-snapshot-28",
40
+ "@instructure/ui-text-input": "11.7.2-snapshot-28",
41
+ "@instructure/ui-themes": "11.7.2-snapshot-28",
42
+ "@instructure/ui-utils": "11.7.2-snapshot-28"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@testing-library/jest-dom": "^6.6.3",
46
46
  "@testing-library/react": "15.0.7",
47
47
  "@testing-library/user-event": "^14.6.1",
48
48
  "vitest": "^3.2.2",
49
- "@instructure/ui-babel-preset": "11.7.2-snapshot-27"
49
+ "@instructure/ui-babel-preset": "11.7.2-snapshot-28"
50
50
  },
51
51
  "peerDependencies": {
52
52
  "react": ">=18 <=19",
@@ -631,6 +631,8 @@ class SourceCodeEditor extends Component<SourceCodeEditorProps> {
631
631
  userEvent = 'delete.backward'
632
632
  }
633
633
 
634
+ const scrollTop = this._editorView.scrollDOM.scrollTop
635
+
634
636
  this.dispatchViewChanges({
635
637
  changes: {
636
638
  from: 0,
@@ -640,6 +642,14 @@ class SourceCodeEditor extends Component<SourceCodeEditorProps> {
640
642
  selection: this._newSelectionAfterValueChange,
641
643
  userEvent: userEvent
642
644
  })
645
+
646
+ // Restore scroll position after CodeMirror updates the DOM
647
+ this.addAnimationFrame(() => {
648
+ if (this._editorView) {
649
+ this._editorView.scrollDOM.scrollTop = scrollTop
650
+ }
651
+ })
652
+
643
653
  this._newSelectionAfterValueChange = undefined
644
654
  }
645
655