T
- the type of the component which implements the interfacepublic interface Focusable<T extends Component> extends HasElement, BlurNotifier<T>, FocusNotifier<T>, HasEnabled
BlurNotifier
,
FocusNotifier
BlurNotifier.BlurEvent<C extends Component>
FocusNotifier.FocusEvent<C extends Component>
Modifier and Type | Method and Description |
---|---|
default ShortcutRegistration |
addFocusShortcut(Key key,
KeyModifier... keyModifiers)
|
default void |
blur()
Calls the
blur function at the client, making the component
lose keyboard focus. |
default void |
focus()
Calls the
focus function at the client, making the component
keyboard focused. |
default int |
getTabIndex()
Gets the
tabindex in the component. |
default void |
setTabIndex(int tabIndex)
Sets the
tabindex attribute in the component. |
addBlurListener
addFocusListener
isEnabled, setEnabled
getElement
default void setTabIndex(int tabIndex)
tabindex
attribute in the component. The tabIndex
indicates if its element can be focused, and if/where it participates in
sequential keyboard navigation:
tabindex = -1
means that the
component should be focusable, but should not be reachable via sequential
keyboard navigation.tabindex = 0
means that the component should be
focusable in sequential keyboard navigation, but its order is defined by
the document's source order.tabindex = 4
would be focused before
tabindex = 5
, but after tabindex = 3
. If
multiple components share the same positive tabindex value, their order
relative to each other follows their position in the document
source.tabIndex
- the tabindex attributedefault int getTabIndex()
tabindex
in the component. The tabIndex indicates
if its element can be focused, and if/where it participates in sequential
keyboard navigation.
If there's no such attribute set, it returns the default setting for the
element, which depends on the element and on the browser. If the
attribute cannot be parsed to int
, then an
IllegalStateException
is thrown.
IllegalStateException
- if the returned tabindex from the element is empty or can not
be parsed to intdefault void focus()
focus
function at the client, making the component
keyboard focused.default void blur()
blur
function at the client, making the component
lose keyboard focus.default ShortcutRegistration addFocusShortcut(Key key, KeyModifier... keyModifiers)
Component
which implements
Focusable
interface. The shortcut's event listener is in global
scope and the shortcut's lifecycle is tied to this
component.
Use the returned ShortcutRegistration
to fluently configure the
shortcut.
key
- primary Key
used to trigger the shortcut. Cannot be
null.keyModifiers
- KeyModifiers
that need to be pressed along
with the key
for the shortcut to triggerShortcutRegistration
for configuring the shortcut and
removingCopyright © 2025. All rights reserved.