mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-22 05:49:03 +01:00
Make tab & enter behave the same when editing
This commit is contained in:
parent
8d523f31a5
commit
d1164fba33
@ -1042,22 +1042,24 @@ export const Et2WithSearchMixin = dedupeMixin(<T extends Constructor<LitElement>
|
||||
|
||||
if(Et2WidgetWithSearch.TAG_BREAK.indexOf(event.key) !== -1 && this.allowFreeEntries)
|
||||
{
|
||||
// Prevent default, since that would try to submit
|
||||
event.preventDefault();
|
||||
this.stopEdit();
|
||||
// Try to pass focus on
|
||||
if(!this.multiple)
|
||||
|
||||
// Mess with tabindexes to allow focus to easily go to next control
|
||||
const input = this.select.shadowRoot.querySelector('[tabindex="0"]');
|
||||
input.setAttribute("tabindex", "-1");
|
||||
this.updateComplete.then(() =>
|
||||
{
|
||||
waitForEvent(this, "sl-after-hide").then(() =>
|
||||
{
|
||||
this.blur();
|
||||
})
|
||||
}
|
||||
// Set it back so we can get focus again later
|
||||
input.setAttribute("tabindex", "0");
|
||||
})
|
||||
return;
|
||||
}
|
||||
// Abort edit, put original value back
|
||||
else if(event.key == "Escape")
|
||||
{
|
||||
this.stopEdit(true);
|
||||
// Prevent default, since that would try to close popup
|
||||
event.preventDefault();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user