Add accessible toolbar component#50
Open
joshsadam wants to merge 23 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
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, andPathogen::Toolbar::Separatorcomponents with required accessible naming and optionalaria-controls. - Add
pathogen--toolbarStimulus 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.
2a73a78 to
c7c7cc5
Compare
44d1269 to
fa874bd
Compare
fa874bd to
979a4f9
Compare
979a4f9 to
b79b4f5
Compare
b79b4f5 to
ee9ddab
Compare
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.
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.
ee9ddab to
dbc5b35
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do and why?
Pathogen::Toolbarcomponent so apps get one accessible, consistent action row for grids, panels, and dialogs.Pathogen::Toolbarcomponent for accessible control groups above grids #49Screenshots or screen recordings
Within IRIDA Next
More available in lookbook previews
How to set up and validate locally
bin/test test/components/pathogen/toolbar_test.rbpnpm test test/javascript/controllers/toolbar_controller.test.jspnpm run build:css:checkbin/dev, open Lookbook, and check the Toolbar Overview and Full-width & reflow previews.Test within IRIDA Next
pathogen/toolbar(integration branch for toolbar adoption; may still be in progress)pathogen-view-componentscheckout (this rebased branch or a release cut from it).PR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.