Skip to content

OpenConceptLab/ocl_online#891 | The arrow keys go through every item of the Actions menus - #131

Open
paynejd wants to merge 2 commits into
mainfrom
ocl_online-891-menu-keyboard
Open

paynejd wants to merge 2 commits into
mainfrom
ocl_online-891-menu-keyboard

Conversation

@paynejd

@paynejd paynejd commented Dec 4, 2026

Copy link
Copy Markdown
Member

Closes OpenConceptLab/ocl_online#891

The arrow keys now go through every item of the Actions menus of a repository, a concept, a mapping and a reference, of the header's + menu, and of the menu in a concept's history. Before, they reached nothing, and Tab closed the menu: MUI's Menu moves between MenuItems only, and these menus were lists of ListItemButtons.

What changes

  • ActionMenuItem is a MenuItem that looks like the ListItemButton it replaces. With an href it's a real link, as before.
  • A locked item can have the focus, also in the references table's bulk menu. It's highlighted like any other and shows its reason, and screen readers get the reason as its description. Enter, Space and a click do nothing on it, as before, and it has no address for the browser's own menu to open. A lock that arrives while the menu is open leaves the focus where it is.
  • The lists are menus for screen readers. Three of them said they were list boxes.
  • In a concept's history, "View resource version" threw callback is not a function on every click. It now closes the menu and opens the version.

How it looks

The menus were photographed before and after at 1440 and 390 px, with and without locks: 26 pictures, 22 of them identical to the pixel. In the other four, a locked concept's or mapping's menu, the lock icon is now at the item's right edge, where the repository's and the reference's menus already had it. That was agreed with the ticket's owner.

How it was checked

  • menuKeyboard.test.js is new, and all ten of its tests fail without the change. It checks that every item of each menu is a menu item, and that a locked one has its reason and can have the focus.
  • In a browser, against a stand-in for the API: arrow keys, End, Enter and Escape in each menu, with the focus going back to its button, and the same menus by mouse.
  • The whole suite (420 tests) and ESLint pass.
  • Not checked on staging. There I'd open a repository's Actions menu with the keyboard, go down to the last item, and press Escape.

With the "Switch to HEAD to edit" line (OpenConceptLab/ocl_online#890)

That change isn't open yet. It adds one more item to the repository's, concept's and mapping's menus, so the two conflict in those three files (RepoManagementList.jsx, ConceptManagementList.jsx, MappingManagementList.jsx). This one goes first. I then bring the other onto it: its item becomes an ActionMenuItem, and its ListItem wrappers go.

Known limit

The menus in the Versions tab and in the filters stay as they are. They were MenuItems already, so the arrow keys work there, but they skip what's locked, and its reason shows on hover only.

🤖 Generated with Claude Code

https://claude.ai/code/session_01AaZ4qVmwkeg26E7AcP35TN

paynejd and others added 2 commits December 4, 2026 06:04
…of the Actions menus

MUI's MenuList moves between MenuItems only. The Actions menus of a
repository, a concept, a mapping and a reference, the header's + menu
and the menu in a concept's history were lists of ListItemButtons, so
the arrow keys reached nothing and Tab closed the menu.

ActionMenuItem is a MenuItem that looks like the ListItemButton it
replaces, and a real link when it has an address. A locked item can
have the focus, which shows its reason, and screen readers get the
reason as the item's description.

In a concept's history, "View resource version" called its click event
as a function and threw. It now closes the menu and keeps the version
whose link is being followed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qVmwkeg26E7AcP35TN
…ps the focus when the lock arrives late

A browser opens a focused link from its own menu too, so a disabled item
isn't a link. A notice can lock an item while its menu is open: the item
stays the same element then, so the focus and the arrow keys stay.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qVmwkeg26E7AcP35TN
@paynejd
paynejd requested a review from snyaggarwal December 4, 2026 11:17
@paynejd

paynejd commented Dec 4, 2026

Copy link
Copy Markdown
Member Author

Codex review, pass 1 (codex-cli 0.171.0, commit 1da203f)

5 findings: P1 1, P2 4.

  • F1.1 (P1) ConceptManagementList.jsx:28: The locked concept and mapping menus fail the visual parity criterion.
  • F1.2 (P2) NoticeLocks.jsx:50: The newly focusable locked repository Edit item still exposes a live link.
  • F1.3 (P2) NoticeLocks.jsx:49: A notice that arrives while the menu is open can interrupt arrow-key navigation.
  • F1.4 (P2) ActionMenuItem.jsx:16: The converted menus lack a visible keyboard focus indicator in forced-colors mode.
  • F1.5 (P2) menuKeyboard.test.js:15: The static markup tests miss regressions in the keyboard interactions they describe.
findings.json
{
  "reviewer": "codex-cli 0.171.0",
  "perspective": "defects",
  "mode": "full",
  "commit": "1da203f0fc7c969ff99224b86b74ab44de1254bd",
  "verdict": "findings",
  "prior": [],
  "findings": [
    {
      "id": "F1.1",
      "severity": "P1",
      "tag": null,
      "file": "src/components/concepts/ConceptManagementList.jsx",
      "line": 28,
      "claim": "The locked concept and mapping menus fail the visual parity criterion.",
      "scenario": "At both 1440 px and 390 px, a locked Edit or Retire row places the lock at the far right. In the base version it sits beside the label. The ticket owner’s approval for this change is pending.",
      "action": "Keep the lock beside the label in those two menus while retaining the focusable MenuItem, or obtain approval for the new placement.",
      "lines_delta": null,
      "confidence": "high"
    },
    {
      "id": "F1.2",
      "severity": "P2",
      "tag": null,
      "file": "src/components/common/NoticeLocks.jsx",
      "line": 50,
      "claim": "The newly focusable locked repository Edit item still exposes a live link.",
      "scenario": "On a HEAD repository with Edit locked, a Chromium user can focus Edit and use Shift+F10 followed by Open link in new tab. Chromium takes the URL from the focused anchor and opens the edit form without invoking the disabled click handler. [Chromium keyboard context menu implementation](https://github.com/chromium/chromium/blob/main/third_party/blink/renderer/core/page/context_menu_controller.cc#L473-L489)",
      "action": "Omit the href while the item is locked and retain its menuitem role, focusability, and description.",
      "lines_delta": null,
      "confidence": "high"
    },
    {
      "id": "F1.3",
      "severity": "P2",
      "tag": null,
      "file": "src/components/common/NoticeLocks.jsx",
      "line": 49,
      "claim": "A notice that arrives while the menu is open can interrupt arrow-key navigation.",
      "scenario": "Open repository Actions by keyboard while its notices request is pending. If the response locks the focused Edit row after the menu finishes opening, LockTooltip replaces that row’s DOM node. MUI’s initial focus has already run, so focus leaves the menu list and the arrow keys stop moving between items until the menu is reopened.",
      "action": "Keep the focused menu item and its wrapper mounted across lock changes, or restore focus to the replacement item when the lock changes.",
      "lines_delta": null,
      "confidence": "medium"
    },
    {
      "id": "F1.4",
      "severity": "P2",
      "tag": null,
      "file": "src/components/common/ActionMenuItem.jsx",
      "line": 16,
      "claim": "The converted menus lack a visible keyboard focus indicator in forced-colors mode.",
      "scenario": "With a Windows contrast theme active, open Mapping Actions and arrow between Edit and Retire. MUI removes the outline, and the browser maps the focused row’s background to the same system color as the menu surface. The user cannot see which enabled action Enter will choose. [CSS forced-colors rules](https://www.w3.org/TR/css-color-adjust-1/#forced-colors-properties)",
      "action": "Add an inset outline using a system color under forced-colors mode for both enabled and locked focused rows.",
      "lines_delta": null,
      "confidence": "high"
    },
    {
      "id": "F1.5",
      "severity": "P2",
      "tag": null,
      "file": "src/components/common/__tests__/menuKeyboard.test.js",
      "line": 15,
      "claim": "The static markup tests miss regressions in the keyboard interactions they describe.",
      "scenario": "All nine tests still pass with focus restoration disabled for Concept Actions and focus-triggered lock tooltips disabled in NoticeLocks. The Menu stub and static render discard both interactions, so the suite stays green when Escape stops returning focus and keyboard users stop seeing the lock reason.",
      "action": "Add a browser or DOM interaction test that opens a real menu from its trigger, arrows to a locked item, checks the tooltip and blocked activation, and verifies that Escape returns focus to the trigger.",
      "lines_delta": null,
      "confidence": "high"
    }
  ]
}

@paynejd

paynejd commented Dec 4, 2026

Copy link
Copy Markdown
Member Author

Answer to pass 1. No P0 or P1 is open.

  • F1.1 (P1, the lock icon's place): approved by the ticket's owner, who has seen the pictures. It's where the repository's and the reference's menus have it.
  • F1.2 (P2, a locked Edit is still a link): fixed in 9559529. A disabled item has no address. The test was seen failing first.
  • F1.3 (P2, a notice arrives while the menu is open): fixed in 9559529. It was reproduced in a browser first: the focus left the menu and the arrow keys stopped. The item now stays the same element, and the focus stays on it, in the repository's, concept's and mapping's menus. The test was seen failing first.
  • F1.4 (P2, forced colors): accepted. MUI draws no outline on any menu item or list button, so every menu in the app is like this, and these were before. It needs one rule for all of them.
  • F1.5 (P2, the tests don't press keys): accepted. The repository's tests render to static markup, without a DOM. They check what MUI needs to make the keys work, and fail without the change. The keys, the reason on focus and the focus going back to the button were checked in a browser, menu by menu.

@paynejd

paynejd commented Dec 4, 2026

Copy link
Copy Markdown
Member Author

Simplification review (claude subagent, commit 9559529)

3 findings: .

  • S1 (shrink) History.jsx:50: The same 70-character sx object ({padding: '4px 10px', '&:hover': {color: 'inherit'}, '&:focus': {outline: 'none', textDecoration: 'none', color: 'inherit'}}) is written out four times on the lines this diff rewrites, one per ActionMenuItem in VersionMenu.
  • S2 (shrink) ActionMenuItem.jsx:4: Every caller passes the same padding '8px 12px' and wraps the icon in <ListItemIcon sx={{minWidth: 'auto', marginRight: '12px'}}>. LIKE_A_LIST_BUTTON already sets the icon's minWidth, so the repeated icon sx duplicates part of it. The convert-to-MenuItem rewrite is touching all these lines anyway.
  • S3 (reuse) ReferenceManagementList.jsx:40: The Delete item hand-writes the Tooltip + display:block span + aria-description wrapper that LockableMenuItem in NoticeLocks.jsx now provides (the same structure, added in this diff).
findings.json
{
  "reviewer": "claude subagent",
  "perspective": "simplify",
  "mode": "full",
  "commit": "95595299586001f5c0d0c4223cb649e2e972b2cb",
  "verdict": "findings",
  "prior": [],
  "findings": [
    {
      "id": "S1",
      "severity": null,
      "tag": "shrink",
      "file": "src/components/concepts/History.jsx",
      "line": 50,
      "claim": "The same 70-character sx object ({padding: '4px 10px', '&:hover': {color: 'inherit'}, '&:focus': {outline: 'none', textDecoration: 'none', color: 'inherit'}}) is written out four times on the lines this diff rewrites, one per ActionMenuItem in VersionMenu.",
      "action": "Declare one const ITEM_SX above VersionMenu (as AddMenuList already does with ITEM_SX) and pass sx={ITEM_SX} to each of the four items.",
      "scenario": null,
      "lines_delta": -3,
      "confidence": "medium"
    },
    {
      "id": "S2",
      "severity": null,
      "tag": "shrink",
      "file": "src/components/common/ActionMenuItem.jsx",
      "line": 4,
      "claim": "Every caller passes the same padding '8px 12px' and wraps the icon in <ListItemIcon sx={{minWidth: 'auto', marginRight: '12px'}}>. LIKE_A_LIST_BUTTON already sets the icon's minWidth, so the repeated icon sx duplicates part of it. The convert-to-MenuItem rewrite is touching all these lines anyway.",
      "action": "Put padding '8px 12px' and the icon's marginRight '12px' into LIKE_A_LIST_BUTTON ('& .MuiListItemIcon-root': {minWidth: 'auto', marginRight: '12px'}). Drop the per-item sx and per-icon sx, keeping only the overrides (History's 4px 10px, the error colour). This is optional, because the icon sx is pre-existing and the change enlarges the diff.",
      "scenario": null,
      "lines_delta": -15,
      "confidence": "low"
    },
    {
      "id": "S3",
      "severity": null,
      "tag": "reuse",
      "file": "src/components/references/ReferenceManagementList.jsx",
      "line": 40,
      "claim": "The Delete item hand-writes the Tooltip + display:block span + aria-description wrapper that LockableMenuItem in NoticeLocks.jsx now provides (the same structure, added in this diff).",
      "action": "Render <LockableMenuItem lock={deleteDisabledReason || null} ...>, with the LockMark inside. This only works if canDelete and deleteDisabledReason always change together. Check the callers first: !canDelete with an empty reason would still be disabled here but not through LockableMenuItem, so the shrink may not be safe.",
      "scenario": null,
      "lines_delta": -4,
      "confidence": "low"
    }
  ]
}

@paynejd

paynejd commented Dec 4, 2026

Copy link
Copy Markdown
Member Author

Answer to the simplification review. Nothing is cut.

  • S1 (History's styles, written four times): declined. They were there before, and moving them isn't part of this change.
  • S2 (the items' padding and icon margins): declined, for the same reason. It would also change every item of every menu at once.
  • S3 (the reference's Delete as a LockableMenuItem): declined. On a saved version Delete has a reason and no lock icon, and LockableMenuItem always draws one.

@paynejd

paynejd commented Dec 4, 2026

Copy link
Copy Markdown
Member Author

Codex check of commits 1da203f..9559529 (codex-cli 0.171.0)

1 finding: P2 1.

  • FC.1 (P2) NoticeLocks.jsx:50: The focus-preserving tooltip wrapper can leave text selection disabled across the page after overlapping touches on two unlocked actions.
findings.json
{
  "reviewer": "codex-cli 0.171.0",
  "perspective": "defects",
  "mode": "final",
  "commit": "95595299586001f5c0d0c4223cb649e2e972b2cb",
  "verdict": "findings",
  "prior": [
    {
      "id": "F1.1",
      "status": "resolved"
    },
    {
      "id": "F1.2",
      "status": "resolved"
    },
    {
      "id": "F1.3",
      "status": "regressed"
    },
    {
      "id": "F1.4",
      "status": "unresolved"
    },
    {
      "id": "F1.5",
      "status": "unresolved"
    }
  ],
  "findings": [
    {
      "id": "FC.1",
      "severity": "P2",
      "tag": null,
      "file": "src/components/common/NoticeLocks.jsx",
      "line": 50,
      "claim": "The focus-preserving tooltip wrapper can leave text selection disabled across the page after overlapping touches on two unlocked actions.",
      "scenario": "On a touchscreen, hold an enabled Edit Concept row, touch the enabled Retire row with a second finger, then release the first finger before the second. Invoking the MUI touch handlers in this order leaves the body's WebkitUserSelect set to none. The second tooltip saved the value set by the first and restores it after the first clears it. Both handlers finish, so closing the menu leaves text selection disabled.",
      "action": "Pass disableTouchListener={!lock} to Tooltip so unlocked rows keep the same DOM structure without running the tooltip's touch handling.",
      "lines_delta": null,
      "confidence": "high"
    }
  ]
}

@paynejd

paynejd commented Dec 4, 2026

Copy link
Copy Markdown
Member Author

Answer to the closing check. No P0 or P1 is open, and no commit follows.

  • FC.1 (P2, two fingers on two items at once): accepted. MUI's tooltips do this wherever two of them are touched at the same time, and the app has them side by side in many places. It takes holding one menu item while touching another, and reloading the page ends it.

This branch has not been deployed

No deployments
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.

1 participant