Skip to content

Identify rotor navigation modes by a stable key rather than their translated label #1247

Description

@jooyoungseo

Context

#1246 routes every rotor mode name through the dictionary (rotor.dataMode, rotor.gridMode, …). RotorNavigationService (src/service/rotor.ts) still identifies the active mode by comparing the label string, so the comparisons now read mode === t('rotor.gridMode'). getActiveFilterUnit() matches filter units the same way, by unit.label === mode.

This is consistent today: both sides render from the same active locale within one keystroke, and no two mode names collide in English or Korean. It is still a display string doing the job of an identity.

Risk

  • A future locale in which two mode names render identically would silently merge those modes; isDataMode() could then misclassify a compare mode as data mode and disable the rotor.
  • Every arrow keystroke re-renders up to seven mode names to find the active one.

Proposal

Give each mode a stable key beside its label and compare on the key:

interface RotorMode {
  key: 'data' | 'grid' | 'point' | 'intersection' | 'lower' | 'higher' | `filter:${string}`;
  label: string;
}

getAvailableModes() returns RotorMode[], the mode comparisons become mode.key === 'grid', and only the announcement uses label. The same shape would suit RotorFilterUnit (key, label, noun) in src/model/abstract.ts, which already carries a key.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    releasedFor issues/features released

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions