MCPcopy Create free account
hub / github.com/aspnet/AzureSignalR-samples / _keydown

Method _keydown

aspnet-samples/AspNetForm/Scripts/bootstrap.js:4148–4168  ·  view source on GitHub ↗
(event)

Source from the content-addressed store, hash-verified

4146 this._queueCallback(complete, element, element.classList.contains(CLASS_NAME_FADE$1));
4147 }
4148 _keydown(event) {
4149 if (![ARROW_LEFT_KEY, ARROW_RIGHT_KEY, ARROW_UP_KEY, ARROW_DOWN_KEY, HOME_KEY, END_KEY].includes(event.key)) {
4150 return;
4151 }
4152 event.stopPropagation(); // stopPropagation/preventDefault both added to support up/down keys without scrolling the page
4153 event.preventDefault();
4154 const children = this._getChildren().filter(element => !isDisabled(element));
4155 let nextActiveElement;
4156 if ([HOME_KEY, END_KEY].includes(event.key)) {
4157 nextActiveElement = children[event.key === HOME_KEY ? 0 : children.length - 1];
4158 } else {
4159 const isNext = [ARROW_RIGHT_KEY, ARROW_DOWN_KEY].includes(event.key);
4160 nextActiveElement = getNextActiveElement(children, event.target, isNext, true);
4161 }
4162 if (nextActiveElement) {
4163 nextActiveElement.focus({
4164 preventScroll: true
4165 });
4166 Tab.getOrCreateInstance(nextActiveElement).show();
4167 }
4168 }
4169 _getChildren() {
4170 // collection of inner elements
4171 return SelectorEngine.find(SELECTOR_INNER_ELEM, this._parent);

Callers 1

constructorMethod · 0.95

Calls 5

_getChildrenMethod · 0.95
isDisabledFunction · 0.70
getNextActiveElementFunction · 0.70
showMethod · 0.45
getOrCreateInstanceMethod · 0.45

Tested by

no test coverage detected