@primer/behaviors 0.0.0-20250829152615 → 0.0.0-20251027175934
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/dist/cjs/focus-zone.js +10 -9
- package/dist/esm/focus-zone.mjs +10 -9
- package/package.json +1 -1
package/dist/cjs/focus-zone.js
CHANGED
|
@@ -97,15 +97,16 @@ function shouldIgnoreFocusHandling(keyboardEvent, activeElement) {
|
|
|
97
97
|
}
|
|
98
98
|
if (isEditable) {
|
|
99
99
|
const isInputElement = activeElement instanceof HTMLTextAreaElement || activeElement instanceof HTMLInputElement;
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
activeElement.selectionStart === activeElement.value.length &&
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
100
|
+
if (isInputElement) {
|
|
101
|
+
const cursorAtStart = activeElement.selectionStart === 0 && activeElement.selectionEnd === 0;
|
|
102
|
+
const cursorAtEnd = activeElement.selectionStart === activeElement.value.length &&
|
|
103
|
+
activeElement.selectionEnd === activeElement.value.length;
|
|
104
|
+
if (key === 'ArrowLeft' && !cursorAtStart) {
|
|
105
|
+
return true;
|
|
106
|
+
}
|
|
107
|
+
if (key === 'ArrowRight' && !cursorAtEnd) {
|
|
108
|
+
return true;
|
|
109
|
+
}
|
|
109
110
|
}
|
|
110
111
|
const isContentEditable = activeElement instanceof HTMLElement && activeElement.isContentEditable;
|
|
111
112
|
if (activeElement instanceof HTMLTextAreaElement || isContentEditable) {
|
package/dist/esm/focus-zone.mjs
CHANGED
|
@@ -95,15 +95,16 @@ function shouldIgnoreFocusHandling(keyboardEvent, activeElement) {
|
|
|
95
95
|
}
|
|
96
96
|
if (isEditable) {
|
|
97
97
|
const isInputElement = activeElement instanceof HTMLTextAreaElement || activeElement instanceof HTMLInputElement;
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
activeElement.selectionStart === activeElement.value.length &&
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
98
|
+
if (isInputElement) {
|
|
99
|
+
const cursorAtStart = activeElement.selectionStart === 0 && activeElement.selectionEnd === 0;
|
|
100
|
+
const cursorAtEnd = activeElement.selectionStart === activeElement.value.length &&
|
|
101
|
+
activeElement.selectionEnd === activeElement.value.length;
|
|
102
|
+
if (key === 'ArrowLeft' && !cursorAtStart) {
|
|
103
|
+
return true;
|
|
104
|
+
}
|
|
105
|
+
if (key === 'ArrowRight' && !cursorAtEnd) {
|
|
106
|
+
return true;
|
|
107
|
+
}
|
|
107
108
|
}
|
|
108
109
|
const isContentEditable = activeElement instanceof HTMLElement && activeElement.isContentEditable;
|
|
109
110
|
if (activeElement instanceof HTMLTextAreaElement || isContentEditable) {
|