You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In editors the enter/shift-enter key should act like the tab/shift-tab key, to store current value and focus the next/ previous element.
There is the following java/ javascript code in vaadin to detect the next/ previous element, and giving them the focus.
The javascript part is most possibly similar in react to detect all focusable elements.
if (et.hasTagName("input") && target.getWidget().getElement().getClassName().contains(" editor ") && event.getKeyCode() == 13)
{
Element next = getNextFocusElement(Document.get(), et, event.getShiftKey());
if (next != null)
{
next.focus();
}
}
private static native Element getNextFocusElement(Document doc, Element elem, boolean previous)
/*-{
var focusable = Array.prototype.filter.call(
doc.querySelectorAll('a:not([disabled]), button:not([disabled]), input:not([disabled]), textarea:not([disabled]), [tabindex]:not([disabled]):not([tabindex="-1"]:not([tabindex="-2"])'),
function (element) {
return (element.offsetWidth > 0 || element.offsetHeight > 0) && element.tabIndex >= 0;
}
);
var index = focusable.indexOf(elem);
if (index < 0)
{
return null;
}
else if (previous)
{
if (index == 0)
{
return focusable[focusable.length - 1];
}
else
{
return focusable[index - 1];
}
}
else
{
if (index < focusable.length - 1)
{
return focusable[index + 1];
}
else
{
return focusable[0];
}
}
}-*/;
The text was updated successfully, but these errors were encountered:
In editors the enter/shift-enter key should act like the tab/shift-tab key, to store current value and focus the next/ previous element.
There is the following java/ javascript code in vaadin to detect the next/ previous element, and giving them the focus.
The javascript part is most possibly similar in react to detect all focusable elements.
The text was updated successfully, but these errors were encountered: