Skip to content

Shortcuts that are triggered only when NumLock is unlocked #145144

@bleroux

Description

@bleroux

Use case

Text navigation using numpad keys is something expected on Linux and Windows. See #144936.

Numpad keys navigation behavior depends on the numLock key state.
For instance, consider numpad4 (left arrow navigation):
Case 1 - When numLock is locked, pressing numpad4 alone is not a navigation shortcut (in a text field, it should print ‘4’).
Case 2 - When numLock is locked, pressing shift and numpad4 is a navigation shortcut.
Case 3 - When numLock is unlocked, pressing numpad4 alone is a navigation shortcut.
Case 4 - When numLock is unlocked, pressing shift and numpad4 is not a navigation shortcut.

It is currently possible to define a shortcut that will be triggered only for case 2 (using LogicalKeySet):

 LogicalKeySet(LogicalKeyboardKey.shiftLeft, LogicalKeyboardKey.numLock, LogicalKeyboardKey.numpad4): const ExtendSelectionByCharacterIntent(forward: false, collapseSelection: false),

AFAIK, it is currently not possible to define a shortcut that will be triggered only for case 3.
Defining a SingleActivator such as:

const SingleActivator(LogicalKeyboardKey.numpad4)

Will trigger the shortcut for case 3, but it will also trigger the shortcut for case 1.

Proposal

Proposal Add a way to specify that a shortcut will be triggered only if numLock is unlocked.

Metadata

Metadata

Assignees

Labels

a: desktopRunning on desktopa: text inputEntering text in a text field or keyboard related problemsc: proposalA detailed proposal for a change to Flutterr: fixedIssue is closed as already fixed in a newer versionteam-text-inputOwned by Text Input team

Type

No type

Projects

Status

Done (PR merged)

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions