Skip to content

Add accessible toolbar component#50

Open
joshsadam wants to merge 23 commits into
mainfrom
001-add-toolbar-component
Open

Add accessible toolbar component#50
joshsadam wants to merge 23 commits into
mainfrom
001-add-toolbar-component

Conversation

@joshsadam

@joshsadam joshsadam commented May 27, 2026

Copy link
Copy Markdown
Contributor

What does this PR do and why?

Screenshots or screen recordings

image

Within IRIDA Next

image

More available in lookbook previews

How to set up and validate locally

  1. bin/test test/components/pathogen/toolbar_test.rb
  2. pnpm test test/javascript/controllers/toolbar_controller.test.js
  3. pnpm run build:css:check
  4. Run bin/dev, open Lookbook, and check the Toolbar Overview and Full-width & reflow previews.
  5. Tab into a toolbar, then use arrow keys and Home/End to move between items and confirm focus stays visible.

Test within IRIDA Next

  1. Checkout branch pathogen/toolbar (integration branch for toolbar adoption; may still be in progress)
  2. Point the Gemfile at your local pathogen-view-components checkout (this rebased branch or a release cut from it).
  3. Open a project Samples page and confirm the toolbar renders above the grid.
  4. Tab into the toolbar and use arrow keys / Home / End to move between items.
  5. If the page includes dropdown menu triggers inside the toolbar, confirm the closed trigger participates in roving focus and that the open menu owns its own keyboard model (popups must stop propagation so the toolbar does not steal arrow keys). Dropdown/menu composition is consumer-managed in v1 — see README Toolbar notes and the Lookbook Overview accessibility list.

PR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

@joshsadam joshsadam self-assigned this May 27, 2026
@joshsadam joshsadam marked this pull request as ready for review May 27, 2026 14:57
@joshsadam joshsadam added the enhancement New feature or request label May 27, 2026
@joshsadam joshsadam requested a review from Copilot May 27, 2026 15:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a new accessible Pathogen::Toolbar ViewComponent (plus button and separator helpers) and a corresponding Stimulus controller to implement APG-style roving focus and keyboard navigation for grouped actions, along with previews, documentation, and test coverage.

Changes:

  • Add Pathogen::Toolbar, Pathogen::Toolbar::Button, and Pathogen::Toolbar::Separator components with required accessible naming and optional aria-controls.
  • Add pathogen--toolbar Stimulus controller implementing roving tabindex, Arrow/Home/End navigation, disabled-item click interception, and text-entry-safe key handling.
  • Add Lookbook previews, README documentation, importmap/controller registration wiring, styles, locales, and unit tests (Ruby + Vitest).

Reviewed changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/javascript/controllers/toolbar_controller.test.js Adds Vitest coverage for roving focus, wrapping navigation, disabled click interception, and text-entry behavior.
test/components/previews/pathogen/toolbar_preview/basic_usage.html.erb Lookbook preview for basic toolbar composition.
test/components/previews/pathogen/toolbar_preview/keyboard_and_accessibility.html.erb Lookbook preview focused on keyboard contract and accessible naming.
test/components/previews/pathogen/toolbar_preview/toggle_buttons.html.erb Preview showing consumer-managed toggle state and mixed children.
test/components/previews/pathogen/toolbar_preview/with_aria_controls.html.erb Preview demonstrating aria-controls with a grid.
test/components/previews/pathogen/toolbar_preview/with_search_input.html.erb Preview demonstrating search input participation without arrow-key hijacking.
test/components/previews/pathogen/toolbar_preview.rb Registers toolbar previews and labels in Lookbook.
test/components/pathogen/toolbar_test.rb Adds ViewComponent tests for toolbar API, ARIA attributes, data merging, and helpers.
README.md Documents toolbar usage and adds controller to the registry list.
config/locales/en.yml Adds i18n strings for toolbar previews.
config/locales/fr.yml Adds French translations for toolbar previews.
config/importmap.rb Pins the toolbar controller for importmap usage.
config/i18n-tasks.yml Adds preview path so i18n-tasks detects preview key usage.
app/components/pathogen/toolbar.rb Implements toolbar root component with ARIA naming validation and Stimulus wiring.
app/components/pathogen/toolbar.html.erb Renders toolbar root wrapper markup.
app/components/pathogen/toolbar/button.rb Adds toolbar-aware button wrapper that composes Pathogen::Button and opts into targeting/ARIA.
app/components/pathogen/toolbar/button.html.erb Renders composed Pathogen::Button with optional visuals.
app/components/pathogen/toolbar/separator.rb Adds semantic vertical separator component.
app/assets/javascripts/pathogen_view_components/toolbar_controller.js Implements roving tabindex + keyboard/click handling for toolbar items.
app/assets/javascripts/pathogen_view_components.js Registers/exports the toolbar controller and updates dev log message.
app/assets/stylesheets/pathogen/components/toolbar.css Adds focus-visible and aria-disabled styling for toolbar items.
app/assets/stylesheets/pathogen.tailwind.css Imports toolbar component CSS into Tailwind build input.
app/assets/stylesheets/pathogen_view_components.css Updates compiled Tailwind output including toolbar styles.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread app/assets/stylesheets/pathogen/components/toolbar.css Outdated
Comment thread app/assets/stylesheets/pathogen/components/toolbar.css Outdated
Comment thread app/components/pathogen/toolbar/button.rb

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 23 out of 23 changed files in this pull request and generated 2 comments.

Comment thread test/components/pathogen/toolbar_test.rb Outdated
Comment thread app/assets/javascripts/pathogen_view_components/toolbar_controller.js Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 23 out of 23 changed files in this pull request and generated no new comments.

@joshsadam joshsadam marked this pull request as draft May 28, 2026 14:14
@joshsadam joshsadam force-pushed the 001-add-toolbar-component branch from 2a73a78 to c7c7cc5 Compare May 28, 2026 18:53
@joshsadam joshsadam marked this pull request as ready for review May 28, 2026 19:01
@joshsadam joshsadam marked this pull request as draft May 29, 2026 12:42
@joshsadam joshsadam marked this pull request as ready for review May 29, 2026 18:27
@joshsadam joshsadam force-pushed the 001-add-toolbar-component branch 2 times, most recently from 44d1269 to fa874bd Compare June 4, 2026 18:24
@joshsadam joshsadam force-pushed the 001-add-toolbar-component branch from fa874bd to 979a4f9 Compare June 10, 2026 16:03
@joshsadam joshsadam marked this pull request as draft June 11, 2026 14:35
@joshsadam joshsadam force-pushed the 001-add-toolbar-component branch from 979a4f9 to b79b4f5 Compare July 3, 2026 20:26
@joshsadam joshsadam changed the title Toolbar Component Add accessible toolbar component Jul 3, 2026
@joshsadam joshsadam marked this pull request as ready for review July 3, 2026 20:40
@joshsadam joshsadam force-pushed the 001-add-toolbar-component branch from b79b4f5 to ee9ddab Compare July 10, 2026 16:26
Add a reusable APG-style toolbar with roving tabindex behavior so host apps can build keyboard-accessible action bars above grids and similar surfaces.
It also wires the new controller and toolbar styles into importmap, Stimulus registration, and bundled CSS so the component works out of the box.
Add Ruby and Stimulus tests for toolbar semantics, keyboard navigation, disabled-action interception, and merged data attribute behavior.
These tests lock in the intended accessibility and integration guarantees of the new toolbar primitives.
Document toolbar usage in the README and add Lookbook preview scenarios with localized copy for accessibility guidance.
Update i18n task search paths so preview-localized keys are validated by repository hooks.
joshsadam added 20 commits July 10, 2026 17:52
Reconnect item targets after morph and stream updates. Ignore
detached nodes so arrow keys keep working. Improve text-entry
boundary checks and caret placement on arrow navigation.
Toolbar navigation was capturing arrow keys inside open menu
popups and resetting roving tabindex during sync. After Turbo
form submits, focus was not returned to the submitter button.
Extract roving focus, menu popup, text entry, and visibility
into importable modules. Scope menu lookup to the toolbar first
and localize the missing-items error via a Stimulus value.
Introduce Toolbar::MenuTrigger for menu-button items and a shared
StimulusDataMerge helper. Rename button tag kwarg to button_tag and
wire localized missing-items messaging on the toolbar root.
Apply focus-visible and disabled styles only to toolbar
targets that are not Pathogen::Button wrappers, avoiding
double rings on Toolbar::Button.
Document automatic resync, pathogen--toolbar:sync, and
MenuTrigger usage so hosts do not reconnect unnecessarily.
Menu popups stay consumer-managed in v1. Remove toolbar
keyboard delegation for open menus and vertical keys on
aria-haspopup triggers. Log a console error for empty
toolbars instead of replacing markup. Inline preview copy
and drop preview i18n keys.
Update usage example and notes now that MenuTrigger is
removed. Document that popups own their open-state
keyboard model and must stop propagation.
Introduce layout helpers for grouped reflow and a table variant
default. Move responsive toolbar layout into component CSS so
breakpoints work without relying on Tailwind classes emitted from
Ruby strings.
Assert Group, Spacer, and variant data attributes. Verify roving
focus still crosses layout group wrappers.
Merge toolbar previews into one compact page aligned with the
design contract. Document composite grid surfaces and drop nested
border stacking in the sample grid demo.
@joshsadam joshsadam force-pushed the 001-add-toolbar-component branch from ee9ddab to dbc5b35 Compare July 10, 2026 22:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Pathogen::Toolbar component for accessible control groups above grids

2 participants