Skip to content

FEAT: Pick an operation from existing values in the labels bar - #2396

Open
varunj-msft wants to merge 3 commits into
microsoft:mainfrom
varunj-msft:varunj-msft/12437-Allow-Selecting-An-Operation
Open

FEAT: Pick an operation from existing values in the labels bar#2396
varunj-msft wants to merge 3 commits into
microsoft:mainfrom
varunj-msft:varunj-msft/12437-Allow-Selecting-An-Operation

Conversation

@varunj-msft

Copy link
Copy Markdown
Contributor

Description

Setting the operation label meant retyping the name from memory. There was a suggestion list meant to help, but it never appeared: it filtered the known values against the value you were replacing, and with the shipped default op_trash_panda that matches nothing.

Clicking the operation label now opens a combobox listing the operations already in memory, using the labels request the bar was already making. Typing filters the list, and offers to create a name that doesn't exist yet.

A few details worth calling out:

  • Existing values are selectable as-is; only new names get validated. Operations created before the current naming rules (like some-op-name) stay usable.
  • The editor now renders in the labels popover too. Clicking a label there used to set edit state but render no editor at all, so on a narrow window — where the chip doesn't fit inline — there was no way to edit it.
  • Label rows are reachable by keyboard, and focus moves into the picker.
  • Escape, clicking away, and Tab all leave without writing a value.

The operation you pick applies to attacks you start afterwards; it doesn't relabel existing ones. It also isn't persisted across a page refresh — that's a separate question about where per-user GUI state should live, so I left it out rather than guess.

No backend or API changes.

Tests and Documentation

21 new tests in LabelsBar.test.tsx covering the picker: options listed on open without clearing the field, filtering, creating a new name, rejecting an invalid one, selecting a legacy value that predates the naming rules, loading and empty states, keyboard select/dismiss, and editing from the popover. Existing label behavior is unchanged and still covered.

  • npx jest src/components/Labels src/components/Home src/App.test.tsx → 113 passing
  • npm run lint and npm run type-check → clean
  • Coverage on LabelsBar.tsx goes up (branches 82.65 → 85.81, lines 89.65 → 92.85)

Docs: added a short paragraph to doc/gui/0_gui.md describing the picker and the "applies to new attacks only" behavior. It's a plain markdown page with no paired notebook, so JupyText doesn't apply here.

Setting the operation label meant retyping the name from memory. The
suggestion list that was supposed to help never appeared, because it
filtered the known values against the value being replaced -- with the
shipped default op_trash_panda that matches nothing.

Editing the operation label now opens a combobox listing the operations
already in memory, sourced from the labels request the bar already makes.
Typing filters the list and offers to create a name that doesn't exist yet.

- Existing values are selectable as-is; only new names are validated, so
  operations created before the current naming rules stay usable.
- The editor now renders in the labels popover too. Clicking a label there
  previously set edit state but rendered no editor, which showed nothing at
  all when the chip was too narrow to fit inline.
- Label rows are reachable by keyboard, and focus moves into the picker.
- Escape, clicking away, and Tab all leave without writing a value.

The selected operation applies to attacks started afterwards; it does not
relabel existing ones.
@romanlutz

Copy link
Copy Markdown
Contributor

Screenshots please! Or video.

The dropdown took its width from the input it hangs off, so longer
operation names were cut off mid-name with no ellipsis --
op_2026_05_mai_image_2.5 rendered as op_2026_05_mai_image. Names never
wrap out of it either: values may only contain letters, digits and
underscores, none of which are line break opportunities.

Widening the input instead would push it past the labels bar and clip
the control itself, so leave the input alone and let the dropdown size
to its own content.
Rejecting a bad name after the fact put the reason in a line of text
beside the picker, and the labels bar clips anything that overflows it.
On a narrow ribbon none of it survived; at full width it read "Only l".
The message also stayed on screen while the name was corrected.

The rules are now stated in the dropdown as the name is typed, and a
name that breaks them is not offered for creation at all. The dropdown
sizes to its contents, so the whole message is always readable.

Fluent dims disabled options to roughly 1.9:1 against their background,
which is too faint for text that has to be read rather than chosen, so
the notes carry their own colour.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants