Skip to content

Teach BorderBox component a list_arguments param#3821

Open
myabc wants to merge 3 commits intoprimer:mainfrom
opf:feature/border-box-list-arguments
Open

Teach BorderBox component a list_arguments param#3821
myabc wants to merge 3 commits intoprimer:mainfrom
opf:feature/border-box-list-arguments

Conversation

@myabc
Copy link
Contributor

@myabc myabc commented Dec 22, 2025

What are you trying to accomplish?

Allows additional customization of the rendered <ul> by supporting system arguments.

Our use case:

We have a lightweight responsive table implementation based on the Border Box component. We are currently in the process of adding ARIA roles and metadata for better A11y support. Unfortunately, we can't apply additional attributes (e.g. ul[role="rowgroup"] without resorting to hackery.

Screenshots

Integration

No. It adds to existing API.

List the issues that this change affects.

Closes #3820

Risk Assessment

  • Low risk the change is small, highly observable, and easily rolled back.
  • Medium risk changes that are isolated, reduced in scope or could impact few users. The change will not impact library availability.
  • High risk changes are those that could impact customers and SLOs, low or no test coverage, low observability, or slow to rollback.

Accessibility

  • No new axe scan violation - This change does not introduce any new axe scan violations.

Merge checklist

  • Added/updated tests
  • Added/updated documentation
  • Added/updated previews (Lookbook)
  • Tested in Chrome
  • Tested in Firefox
  • Tested in Safari
  • Tested in Edge

@changeset-bot
Copy link

changeset-bot bot commented Dec 22, 2025

🦋 Changeset detected

Latest commit: 4ad0024

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/view-components Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@myabc myabc changed the title Teach BorderBox component a list_arguments param Teach BorderBox component a list_arguments param Dec 22, 2025
@myabc myabc marked this pull request as ready for review December 22, 2025 18:17
Copilot AI review requested due to automatic review settings December 22, 2025 18:17
@myabc myabc requested a review from a team as a code owner December 22, 2025 18:17
@myabc myabc requested a review from llastflowers December 22, 2025 18:17
Copy link
Contributor

Copilot AI left a comment

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 adds a list_arguments parameter to the BorderBox component, enabling developers to pass custom system arguments to the internal <ul> element. This addresses accessibility needs, particularly for cases where ARIA roles and metadata are required for the list element.

Key changes:

  • Added list_arguments parameter to BorderBox component initialization
  • Updated playground preview to demonstrate the new parameter
  • Added test coverage for the new functionality

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
app/components/primer/beta/border_box.rb Added list_arguments parameter to the component's initializer, processes it with deny_tag_argument, and sets it on @list_arguments instance variable
test/components/beta/border_box_test.rb Added test case verifying that custom attributes (id, role) can be passed via list_arguments and are properly rendered on the list element
previews/primer/beta/border_box_preview.rb Updated playground preview to include list_id parameter demonstrating the new list_arguments functionality
.changeset/rare-coats-hide.md Added changeset entry documenting this as a patch-level change

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

Allows additional customization of the rendered `<ul>` by supporting
system arguments.

Closes primer#3820
@myabc myabc force-pushed the feature/border-box-list-arguments branch from 88f6673 to 4ad0024 Compare December 22, 2025 18:32
}
@list_arguments[:aria] = merge_aria(
@list_arguments,
{ aria: { labelledby: header.id } }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could also explicitly disallow aria-label. However, this is probably being overly-defensive and I don't think it's being done elsewhere.

Copy link
Contributor

Copilot AI left a comment

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 4 out of 4 changed files in this pull request and generated no new comments.


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

@myabc
Copy link
Contributor Author

myabc commented Dec 30, 2025

Update: it turns out there are issues with our original use case:

We have a lightweight responsive table implementation based on the Border Box component. We are currently in the process of adding ARIA roles and metadata for better A11y support. Unfortunately, we can't apply additional attributes (e.g. ul[role="rowgroup"] without resorting to hackery.

Applying role="rowgroup" to a ul tag violates Best Practices. One solution might be to allow support for rendering a different element via tag:/list_arguments: { tag: } params. However this might also overly complicate a pretty simple component.

As such we (OpenProject devs) probably need to discuss internally before proceeding. @HDinger

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.

BorderBox list does not support system arguments

1 participant