Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_onkeydown(event) {
if (isShow(event) && !this.readonly && !this.disabled) {
event.preventDefault();
this._togglePopover();
}
if (isDown(event) && this._getPopover()._isOpen && this.items.length) {
event.preventDefault();
const list = this.shadowRoot.querySelector(".ui5-multi-combobox-all-items-list");
list._itemNavigation.current = 0;
list.items[0].focus();
}
if (isBackSpace(event) && event.target.value === "") {
event.preventDefault();
const lastTokenIndex = this._tokenizer.tokens.length - 1;
if (lastTokenIndex < 0) {
return;
}
this._tokenizer.tokens[lastTokenIndex].focus();
_handleArrowNavigation(event, shouldFireEvent) {
let nextIndex = -1;
const isDownKey = isDown(event);
const isUpKey = isUp(event);
if (isDownKey || isUpKey) {
event.preventDefault();
if (isDownKey) {
nextIndex = this._getNextOptionIndex();
} else {
nextIndex = this._getPreviousOptionIndex();
}
this.options[this._selectedIndex].selected = false;
this.options[nextIndex].selected = true;
this._selectedIndex = nextIndex === -1 ? this._selectedIndex : nextIndex;
if (shouldFireEvent) {
this.fireEvent("change", { selectedOption: this.options[nextIndex] });
_onkeydown(event) {
if (isUp(event)) {
return this._handleUp(event);
}
if (isDown(event)) {
return this._handleDown(event);
}
if (isSpace(event)) {
return this._handleSpace(event);
}
if (isEnter(event)) {
return this._handleEnter(event);
}
this._keyDown = true;
}
_onkeydown(event) {
if (isSpace(event)) {
return event.preventDefault();
}
if (isEnter(event)) {
return this.toggle();
}
if (isDown(event) || isRight(event)) {
this._handleDown(event);
}
if (isUp(event) || isLeft(event)) {
this._handleUp(event);
}
}