@primer/behaviors 1.8.3-rc.9620f24 → 1.8.4-rc.c90131c
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
CHANGED
|
@@ -84,18 +84,20 @@ function shouldIgnoreFocusHandling(keyboardEvent, activeElement) {
|
|
|
84
84
|
const key = keyboardEvent.key;
|
|
85
85
|
const keyLength = [...key].length;
|
|
86
86
|
const isEditable = isEditableElement.isEditableElement(activeElement);
|
|
87
|
+
const isSelect = activeElement instanceof HTMLSelectElement;
|
|
87
88
|
if (isEditable && (keyLength === 1 || key === 'Home' || key === 'End')) {
|
|
88
89
|
return true;
|
|
89
90
|
}
|
|
90
|
-
if (
|
|
91
|
+
if (isSelect) {
|
|
91
92
|
if (key === 'ArrowDown' && userAgent.isMacOS() && !keyboardEvent.metaKey) {
|
|
92
93
|
return true;
|
|
93
94
|
}
|
|
94
95
|
if (key === 'ArrowDown' && !userAgent.isMacOS() && keyboardEvent.altKey) {
|
|
95
96
|
return true;
|
|
96
97
|
}
|
|
98
|
+
return false;
|
|
97
99
|
}
|
|
98
|
-
if (isEditable) {
|
|
100
|
+
if (isEditable && !isSelect) {
|
|
99
101
|
const isInputElement = activeElement instanceof HTMLTextAreaElement || activeElement instanceof HTMLInputElement;
|
|
100
102
|
const cursorAtStart = isInputElement && activeElement.selectionStart === 0 && activeElement.selectionEnd === 0;
|
|
101
103
|
const cursorAtEnd = isInputElement &&
|
package/dist/esm/focus-zone.mjs
CHANGED
|
@@ -82,18 +82,20 @@ function shouldIgnoreFocusHandling(keyboardEvent, activeElement) {
|
|
|
82
82
|
const key = keyboardEvent.key;
|
|
83
83
|
const keyLength = [...key].length;
|
|
84
84
|
const isEditable = isEditableElement(activeElement);
|
|
85
|
+
const isSelect = activeElement instanceof HTMLSelectElement;
|
|
85
86
|
if (isEditable && (keyLength === 1 || key === 'Home' || key === 'End')) {
|
|
86
87
|
return true;
|
|
87
88
|
}
|
|
88
|
-
if (
|
|
89
|
+
if (isSelect) {
|
|
89
90
|
if (key === 'ArrowDown' && isMacOS() && !keyboardEvent.metaKey) {
|
|
90
91
|
return true;
|
|
91
92
|
}
|
|
92
93
|
if (key === 'ArrowDown' && !isMacOS() && keyboardEvent.altKey) {
|
|
93
94
|
return true;
|
|
94
95
|
}
|
|
96
|
+
return false;
|
|
95
97
|
}
|
|
96
|
-
if (isEditable) {
|
|
98
|
+
if (isEditable && !isSelect) {
|
|
97
99
|
const isInputElement = activeElement instanceof HTMLTextAreaElement || activeElement instanceof HTMLInputElement;
|
|
98
100
|
const cursorAtStart = isInputElement && activeElement.selectionStart === 0 && activeElement.selectionEnd === 0;
|
|
99
101
|
const cursorAtEnd = isInputElement &&
|