MCPcopy Create free account
hub / github.com/UI5/webcomponents / _keydownHandler

Method _keydownHandler

packages/base/src/features/F6Navigation.ts:139–185  ·  view source on GitHub ↗
(event: KeyboardEvent)

Source from the content-addressed store, hash-verified

137 }
138
139 async _keydownHandler(event: KeyboardEvent) {
140 const openUI5Support = getFeature<typeof OpenUI5Support>("OpenUI5Support");
141 const isOpenUI5Detected = openUI5Support && openUI5Support.isOpenUI5Detected();
142
143 if (isOpenUI5Detected) {
144 this.destroy();
145 return;
146 }
147
148 const forward = isF6Next(event);
149 const backward = isF6Previous(event);
150 if (!(forward || backward)) {
151 return;
152 }
153
154 this.updateGroups();
155
156 if (this.groups.length < 1) {
157 return;
158 }
159
160 event.preventDefault();
161
162 let elementToFocus;
163
164 if (this.groups.length === 0) {
165 elementToFocus = await this.groupElementToFocus(this.groups[0]);
166
167 return elementToFocus?.focus();
168 }
169
170 let currentIndex = -1;
171
172 if (this.selectedGroup) {
173 currentIndex = this.groups.indexOf(this.selectedGroup);
174 }
175
176 if (forward) {
177 elementToFocus = await this.findNextFocusableGroupElement(currentIndex);
178 }
179
180 if (backward) {
181 elementToFocus = await this.findPreviousFocusableGroupElement(currentIndex);
182 }
183
184 elementToFocus?.focus();
185 }
186
187 updateGroups() {
188 const container = this.findContainer();

Callers

nothing calls this directly

Calls 10

destroyMethod · 0.95
updateGroupsMethod · 0.95
groupElementToFocusMethod · 0.95
getFeatureFunction · 0.85
isF6NextFunction · 0.85
isF6PreviousFunction · 0.85
isOpenUI5DetectedMethod · 0.80
focusMethod · 0.45

Tested by

no test coverage detected