@instructure/ui-source-code-editor 11.7.11-snapshot-4 → 11.7.11-snapshot-24
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 +3 -4
- package/es/SourceCodeEditor/v2/index.js +31 -8
- package/lib/SourceCodeEditor/v2/index.js +31 -8
- package/package.json +13 -13
- package/src/SourceCodeEditor/v2/index.tsx +38 -7
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/SourceCodeEditor/v2/index.d.ts +3 -0
- package/types/SourceCodeEditor/v2/index.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,12 +3,11 @@
|
|
|
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.11-snapshot-
|
|
7
|
-
|
|
8
|
-
**Note:** Version bump only for package @instructure/ui-source-code-editor
|
|
9
|
-
|
|
6
|
+
## [11.7.11-snapshot-24](https://github.com/instructure/instructure-ui/compare/v11.7.10...v11.7.11-snapshot-24) (2026-11-23)
|
|
10
7
|
|
|
8
|
+
### Bug Fixes
|
|
11
9
|
|
|
10
|
+
* **ui-source-code-editor:** skip scroller tab stop when the editor is editable ([#2758](https://github.com/instructure/instructure-ui/issues/2758)) ([27e8d41](https://github.com/instructure/instructure-ui/commit/27e8d416271463690331a32ca30694e5c74a6446))
|
|
12
11
|
|
|
13
12
|
|
|
14
13
|
## [11.7.10](https://github.com/instructure/instructure-ui/compare/v11.7.8...v11.7.10) (2026-10-14)
|
|
@@ -88,6 +88,7 @@ let SourceCodeEditor = (_dec = withDeterministicId(), _dec2 = withStyleNew(gener
|
|
|
88
88
|
_raf = [];
|
|
89
89
|
_searchPanelId = 0;
|
|
90
90
|
_isUnmounting = false;
|
|
91
|
+
_resizeObserver;
|
|
91
92
|
_newSelectionAfterValueChange;
|
|
92
93
|
handleSearchPanelMount = (dom, view) => {
|
|
93
94
|
this.setState(state => ({
|
|
@@ -249,14 +250,8 @@ let SourceCodeEditor = (_dec = withDeterministicId(), _dec2 = withStyleNew(gener
|
|
|
249
250
|
state,
|
|
250
251
|
parent: this._containerRef
|
|
251
252
|
});
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
// axe devtools and other automated a11y tests both flagging this issue,
|
|
255
|
-
// which can be observed while navigating with keyboard:
|
|
256
|
-
// Ensure elements that have scrollable content are accessible by keyboard
|
|
257
|
-
// To solve this problem, you need to fix at least (1) of the following:
|
|
258
|
-
// Element should have focusable content, Element should be focusable
|
|
259
|
-
this._editorView.scrollDOM.tabIndex = 0;
|
|
253
|
+
this.updateScrollerFocusability();
|
|
254
|
+
this.observeScrollerOverflow();
|
|
260
255
|
if (autofocus) {
|
|
261
256
|
this.focus();
|
|
262
257
|
}
|
|
@@ -267,6 +262,7 @@ let SourceCodeEditor = (_dec = withDeterministicId(), _dec2 = withStyleNew(gener
|
|
|
267
262
|
}
|
|
268
263
|
componentWillUnmount() {
|
|
269
264
|
this._isUnmounting = true;
|
|
265
|
+
this._resizeObserver?.disconnect();
|
|
270
266
|
this._editorView?.destroy();
|
|
271
267
|
this.cancelAnimationFrames();
|
|
272
268
|
}
|
|
@@ -501,6 +497,33 @@ let SourceCodeEditor = (_dec = withDeterministicId(), _dec2 = withStyleNew(gener
|
|
|
501
497
|
}
|
|
502
498
|
refreshExtensions() {
|
|
503
499
|
this.dispatchViewEffects(StateEffect.reconfigure.of(this.extensions));
|
|
500
|
+
this.updateScrollerFocusability();
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
// a scrollable region must be keyboard reachable (axe: scrollable-region-focusable).
|
|
504
|
+
// An editable textbox already is, so the scroller only needs a tab stop when the
|
|
505
|
+
// textbox can't take focus and the content actually overflows.
|
|
506
|
+
updateScrollerFocusability() {
|
|
507
|
+
const scroller = this._editorView?.scrollDOM;
|
|
508
|
+
if (!scroller) return;
|
|
509
|
+
const overflows = scroller.scrollHeight > scroller.clientHeight || scroller.scrollWidth > scroller.clientWidth;
|
|
510
|
+
if (this.props.editable === false && overflows) {
|
|
511
|
+
scroller.tabIndex = 0;
|
|
512
|
+
scroller.setAttribute('role', 'region');
|
|
513
|
+
scroller.setAttribute('aria-labelledby', this._id);
|
|
514
|
+
} else {
|
|
515
|
+
scroller.removeAttribute('tabindex');
|
|
516
|
+
scroller.removeAttribute('role');
|
|
517
|
+
scroller.removeAttribute('aria-labelledby');
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
// overflow changes with content, wrapping and container size
|
|
522
|
+
observeScrollerOverflow() {
|
|
523
|
+
if (!this._editorView || typeof ResizeObserver === 'undefined') return;
|
|
524
|
+
this._resizeObserver = new ResizeObserver(() => this.updateScrollerFocusability());
|
|
525
|
+
this._resizeObserver.observe(this._editorView.scrollDOM);
|
|
526
|
+
this._resizeObserver.observe(this._editorView.contentDOM);
|
|
504
527
|
}
|
|
505
528
|
refreshEditorValue() {
|
|
506
529
|
if (!this._editorView) return;
|
|
@@ -94,6 +94,7 @@ let SourceCodeEditor = exports.SourceCodeEditor = (_dec = (0, _uiReactUtils.with
|
|
|
94
94
|
_raf = [];
|
|
95
95
|
_searchPanelId = 0;
|
|
96
96
|
_isUnmounting = false;
|
|
97
|
+
_resizeObserver;
|
|
97
98
|
_newSelectionAfterValueChange;
|
|
98
99
|
handleSearchPanelMount = (dom, view) => {
|
|
99
100
|
this.setState(state => ({
|
|
@@ -255,14 +256,8 @@ let SourceCodeEditor = exports.SourceCodeEditor = (_dec = (0, _uiReactUtils.with
|
|
|
255
256
|
state,
|
|
256
257
|
parent: this._containerRef
|
|
257
258
|
});
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
// axe devtools and other automated a11y tests both flagging this issue,
|
|
261
|
-
// which can be observed while navigating with keyboard:
|
|
262
|
-
// Ensure elements that have scrollable content are accessible by keyboard
|
|
263
|
-
// To solve this problem, you need to fix at least (1) of the following:
|
|
264
|
-
// Element should have focusable content, Element should be focusable
|
|
265
|
-
this._editorView.scrollDOM.tabIndex = 0;
|
|
259
|
+
this.updateScrollerFocusability();
|
|
260
|
+
this.observeScrollerOverflow();
|
|
266
261
|
if (autofocus) {
|
|
267
262
|
this.focus();
|
|
268
263
|
}
|
|
@@ -273,6 +268,7 @@ let SourceCodeEditor = exports.SourceCodeEditor = (_dec = (0, _uiReactUtils.with
|
|
|
273
268
|
}
|
|
274
269
|
componentWillUnmount() {
|
|
275
270
|
this._isUnmounting = true;
|
|
271
|
+
this._resizeObserver?.disconnect();
|
|
276
272
|
this._editorView?.destroy();
|
|
277
273
|
this.cancelAnimationFrames();
|
|
278
274
|
}
|
|
@@ -507,6 +503,33 @@ let SourceCodeEditor = exports.SourceCodeEditor = (_dec = (0, _uiReactUtils.with
|
|
|
507
503
|
}
|
|
508
504
|
refreshExtensions() {
|
|
509
505
|
this.dispatchViewEffects(_state.StateEffect.reconfigure.of(this.extensions));
|
|
506
|
+
this.updateScrollerFocusability();
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
// a scrollable region must be keyboard reachable (axe: scrollable-region-focusable).
|
|
510
|
+
// An editable textbox already is, so the scroller only needs a tab stop when the
|
|
511
|
+
// textbox can't take focus and the content actually overflows.
|
|
512
|
+
updateScrollerFocusability() {
|
|
513
|
+
const scroller = this._editorView?.scrollDOM;
|
|
514
|
+
if (!scroller) return;
|
|
515
|
+
const overflows = scroller.scrollHeight > scroller.clientHeight || scroller.scrollWidth > scroller.clientWidth;
|
|
516
|
+
if (this.props.editable === false && overflows) {
|
|
517
|
+
scroller.tabIndex = 0;
|
|
518
|
+
scroller.setAttribute('role', 'region');
|
|
519
|
+
scroller.setAttribute('aria-labelledby', this._id);
|
|
520
|
+
} else {
|
|
521
|
+
scroller.removeAttribute('tabindex');
|
|
522
|
+
scroller.removeAttribute('role');
|
|
523
|
+
scroller.removeAttribute('aria-labelledby');
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
// overflow changes with content, wrapping and container size
|
|
528
|
+
observeScrollerOverflow() {
|
|
529
|
+
if (!this._editorView || typeof ResizeObserver === 'undefined') return;
|
|
530
|
+
this._resizeObserver = new ResizeObserver(() => this.updateScrollerFocusability());
|
|
531
|
+
this._resizeObserver.observe(this._editorView.scrollDOM);
|
|
532
|
+
this._resizeObserver.observe(this._editorView.contentDOM);
|
|
510
533
|
}
|
|
511
534
|
refreshEditorValue() {
|
|
512
535
|
if (!this._editorView) return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-source-code-editor",
|
|
3
|
-
"version": "11.7.11-snapshot-
|
|
3
|
+
"version": "11.7.11-snapshot-24",
|
|
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",
|
|
@@ -28,21 +28,21 @@
|
|
|
28
28
|
"@codemirror/search": "^6.5.6",
|
|
29
29
|
"@codemirror/state": "^6.4.1",
|
|
30
30
|
"@codemirror/view": "^6.34.1",
|
|
31
|
-
"@instructure/emotion": "11.7.11-snapshot-
|
|
32
|
-
"@instructure/shared-types": "11.7.11-snapshot-
|
|
33
|
-
"@instructure/ui-a11y-content": "11.7.11-snapshot-
|
|
34
|
-
"@instructure/ui-buttons": "11.7.11-snapshot-
|
|
35
|
-
"@instructure/ui-dom-utils": "11.7.11-snapshot-
|
|
36
|
-
"@instructure/ui-i18n": "11.7.11-snapshot-
|
|
37
|
-
"@instructure/ui-icons": "11.7.11-snapshot-
|
|
38
|
-
"@instructure/ui-react-utils": "11.7.11-snapshot-
|
|
39
|
-
"@instructure/ui-text-input": "11.7.11-snapshot-
|
|
40
|
-
"@instructure/ui-themes": "11.7.11-snapshot-
|
|
41
|
-
"@instructure/ui-utils": "11.7.11-snapshot-
|
|
31
|
+
"@instructure/emotion": "11.7.11-snapshot-24",
|
|
32
|
+
"@instructure/shared-types": "11.7.11-snapshot-24",
|
|
33
|
+
"@instructure/ui-a11y-content": "11.7.11-snapshot-24",
|
|
34
|
+
"@instructure/ui-buttons": "11.7.11-snapshot-24",
|
|
35
|
+
"@instructure/ui-dom-utils": "11.7.11-snapshot-24",
|
|
36
|
+
"@instructure/ui-i18n": "11.7.11-snapshot-24",
|
|
37
|
+
"@instructure/ui-icons": "11.7.11-snapshot-24",
|
|
38
|
+
"@instructure/ui-react-utils": "11.7.11-snapshot-24",
|
|
39
|
+
"@instructure/ui-text-input": "11.7.11-snapshot-24",
|
|
40
|
+
"@instructure/ui-themes": "11.7.11-snapshot-24",
|
|
41
|
+
"@instructure/ui-utils": "11.7.11-snapshot-24",
|
|
42
42
|
"@lezer/highlight": "1.2.3"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@instructure/ui-babel-preset": "11.7.11-snapshot-
|
|
45
|
+
"@instructure/ui-babel-preset": "11.7.11-snapshot-24",
|
|
46
46
|
"vitest": "^5.0.0"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
@@ -156,6 +156,7 @@ class SourceCodeEditor extends Component<
|
|
|
156
156
|
|
|
157
157
|
private _searchPanelId = 0
|
|
158
158
|
private _isUnmounting = false
|
|
159
|
+
private _resizeObserver?: ResizeObserver
|
|
159
160
|
|
|
160
161
|
private _newSelectionAfterValueChange?: EditorSelection
|
|
161
162
|
|
|
@@ -327,13 +328,8 @@ class SourceCodeEditor extends Component<
|
|
|
327
328
|
parent: this._containerRef
|
|
328
329
|
})
|
|
329
330
|
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
// which can be observed while navigating with keyboard:
|
|
333
|
-
// Ensure elements that have scrollable content are accessible by keyboard
|
|
334
|
-
// To solve this problem, you need to fix at least (1) of the following:
|
|
335
|
-
// Element should have focusable content, Element should be focusable
|
|
336
|
-
this._editorView.scrollDOM.tabIndex = 0
|
|
331
|
+
this.updateScrollerFocusability()
|
|
332
|
+
this.observeScrollerOverflow()
|
|
337
333
|
|
|
338
334
|
if (autofocus) {
|
|
339
335
|
this.focus()
|
|
@@ -347,6 +343,7 @@ class SourceCodeEditor extends Component<
|
|
|
347
343
|
|
|
348
344
|
componentWillUnmount() {
|
|
349
345
|
this._isUnmounting = true
|
|
346
|
+
this._resizeObserver?.disconnect()
|
|
350
347
|
this._editorView?.destroy()
|
|
351
348
|
|
|
352
349
|
this.cancelAnimationFrames()
|
|
@@ -652,6 +649,40 @@ class SourceCodeEditor extends Component<
|
|
|
652
649
|
|
|
653
650
|
refreshExtensions() {
|
|
654
651
|
this.dispatchViewEffects(StateEffect.reconfigure.of(this.extensions))
|
|
652
|
+
this.updateScrollerFocusability()
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
// a scrollable region must be keyboard reachable (axe: scrollable-region-focusable).
|
|
656
|
+
// An editable textbox already is, so the scroller only needs a tab stop when the
|
|
657
|
+
// textbox can't take focus and the content actually overflows.
|
|
658
|
+
private updateScrollerFocusability() {
|
|
659
|
+
const scroller = this._editorView?.scrollDOM
|
|
660
|
+
if (!scroller) return
|
|
661
|
+
|
|
662
|
+
const overflows =
|
|
663
|
+
scroller.scrollHeight > scroller.clientHeight ||
|
|
664
|
+
scroller.scrollWidth > scroller.clientWidth
|
|
665
|
+
|
|
666
|
+
if (this.props.editable === false && overflows) {
|
|
667
|
+
scroller.tabIndex = 0
|
|
668
|
+
scroller.setAttribute('role', 'region')
|
|
669
|
+
scroller.setAttribute('aria-labelledby', this._id)
|
|
670
|
+
} else {
|
|
671
|
+
scroller.removeAttribute('tabindex')
|
|
672
|
+
scroller.removeAttribute('role')
|
|
673
|
+
scroller.removeAttribute('aria-labelledby')
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
// overflow changes with content, wrapping and container size
|
|
678
|
+
private observeScrollerOverflow() {
|
|
679
|
+
if (!this._editorView || typeof ResizeObserver === 'undefined') return
|
|
680
|
+
|
|
681
|
+
this._resizeObserver = new ResizeObserver(() =>
|
|
682
|
+
this.updateScrollerFocusability()
|
|
683
|
+
)
|
|
684
|
+
this._resizeObserver.observe(this._editorView.scrollDOM)
|
|
685
|
+
this._resizeObserver.observe(this._editorView.contentDOM)
|
|
655
686
|
}
|
|
656
687
|
|
|
657
688
|
refreshEditorValue() {
|