Skip to content

Commit

Permalink
Renamed the TabBehavior to KeyTabBehavior
Browse files Browse the repository at this point in the history
  • Loading branch information
Erik Strid authored and bitstorm committed Dec 2, 2024
1 parent fc290a0 commit d0c8035
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ protected final String constructSettingsJS()
{
sb.append(",className: '").append(settings.getCssClassName()).append('\'');
}
sb.append(",tabBehavior: '").append(
settings.getTabBehavior().getValue()).append('\'');
sb.append(",keyTabBehavior: '").append(
settings.getKeyTabBehavior().getValue()).append('\'');
sb.append('}');
return sb.toString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public final class AutoCompleteSettings implements IClusterable

private int minInputLength = 1;

private TabBehavior tabBehavior = TabBehavior.SELECT_FOCUS_NEXT_ELEMENT;
private KeyTabBehavior keyTabBehavior = KeyTabBehavior.SELECT_FOCUS_NEXT_ELEMENT;

/**
* Indicates whether the first item in the list is automatically selected when the autocomplete
Expand Down Expand Up @@ -384,33 +384,34 @@ public AutoCompleteSettings setMinInputLength(int minInputLength)

/**
* Indicates how the Tab key should be handled when having an item in the autocomplete list
* selected, {@link TabBehavior#SELECT_FOCUS_NEXT_ELEMENT} is the default behavior.
* selected, {@link KeyTabBehavior#SELECT_FOCUS_NEXT_ELEMENT} is the default behavior.
*
* @return the behavior that should be used when the Tab key is pressed
*/
public TabBehavior getTabBehavior()
public KeyTabBehavior getKeyTabBehavior()
{
return tabBehavior;
return keyTabBehavior;
}

/**
* Set how the Tab key should be handled when having an item in the autocomplete list selected.
*
* @param tabSelectBehavior the behavior that should be used when the Tab key is pressed,
* {@link TabBehavior#SELECT_FOCUS_NEXT_ELEMENT} is the default behavior
* @param keyTabBehavior the behavior that should be used when the Tab key is pressed,
* {@link KeyTabBehavior#SELECT_FOCUS_NEXT_ELEMENT} is the default behavior
* @return this {@link AutoCompleteSettings}
*/
public AutoCompleteSettings setTabBehavior(TabBehavior tabSelectBehavior)
public AutoCompleteSettings setKeyTabBehavior(KeyTabBehavior keyTabBehavior)
{
this.tabBehavior = tabSelectBehavior;
this.keyTabBehavior = keyTabBehavior;
return this;
}

/**
* A behavior that can be used to control how the Tab key should be handled when having an item
* in the autocomplete list is marked.
*/
public enum TabBehavior {
public enum KeyTabBehavior
{
/**
* Select the currently marked item and move the focus to the next focusable element.
*/
Expand All @@ -422,7 +423,7 @@ public enum TabBehavior {

private final String value;

TabBehavior(String value)
KeyTabBehavior(String value)
{
this.value = value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@

hideAutoComplete();

if (cfg.tabBehavior === 'selectFocusAutocompleteInput' && keyCode === KEY_TAB) {
if (cfg.keyTabBehavior === 'selectFocusAutocompleteInput' && keyCode === KEY_TAB) {
// prevent moving focus to the next component if an item in the dropdown is selected
// using the Tab key
jqEvent.preventDefault();
Expand Down

0 comments on commit d0c8035

Please sign in to comment.